remove null and undefined from array javascript lodash code example
Example 1: lodash remove undefined values from array
var colors = ["red",undefined,"","blue",null,"crap"];
// remove undefined, null, "" and any other crap
var cleanColors=_.without(colors,undefined,null,"","crap");
//cleanColors is now ["red","blue"];
Example 2: lodash remove null from object
_.omitBy({ a: null, b: 1, c: undefined, d: false }, _.isNil)