I have a Javascript object like:
var my_object = { a:undefined, b:2, c:4, d:undefined };
How to remove all the undefined properties? False
Taking in account that undefined == null we can write as follows:
undefined == null
let collection = { a: undefined, b: 2, c: 4, d: null, } console.log(_.omit(collection, it => it == null)) // -> { b: 2, c: 4 }
JSBin example