js 去除对象中的属性名的空值

 例  
    var oldArr = [
            {name: ""},
            {name:"zhang"},
            {name:"zhanga"},
            {name:""},
            {name:"zhan"}
        ];
  var newArr= []; //去除空对象
    for(let i in oldArr) {
        if(oldArr[j].name!="" ) {
            newArr.push(oldArr[j]);
        }
    };
  console.log(newArr);

你可能感兴趣的:(js 去除对象中的属性名的空值)