I want to remove all the keys associated with null, I tried with _.filter, _.compact, _.reject, but nothing works for me, am using latest version of underscore 1.8.3
This is what I tried:
_.reject(Obj,function (value) {
return value===null;
})
_.compact(Obj)
Object:
var Obj = {
"pCon": [
{
"abc": null,
"def": null,
"ghi": {
"content": "abc"
}
},
{
"abc": null,
"def": {
imgURL: "test.png"
},
"ghi": null
},
{
"abc": {
"key": "001"
},
"def": null,
"ghi": null
}
]
}
array_filter()from phpjs.org and it works perfectly fine with few lines of code and it will be more readable than mixing all this underscore functions.undefinedproperties deleted as well?