let obj={ 'a':'a', 'b':null, 'c':'c' } var removePropertyOfNull=function(obj){ Object.keys(obj).forEach(item=>{ if(!obj[item]) delete obj[item] }) return obj; } removePropertyOfNull(obj) //obj={'a':'a','b':'b'}
let obj={ 'a':'a', 'b':null, 'c':'c' } var removePropertyOfNull=function(obj){ Object.keys(obj).forEach(item=>{ if(!obj[item]) delete obj[item] }) return obj; } removePropertyOfNull(obj) //obj={'a':'a','b':'b'}