Remove empty Objects from Array

后端 未结 4 1626
礼貌的吻别
礼貌的吻别 2021-01-21 16:35

I have a JavaScript-array with objects filled in and want to remove every object with no data. It might look like this:

var myArray = [ {id: \"28b\", text:\"Phil         


        
4条回答
  •  春和景丽
    2021-01-21 17:28

    You can try this:

    _.filter(myArray, _.isEmpty)
    

    I assume empty means

    var obj = {}
    

提交回复
热议问题