美文网首页
json数组删除key

json数组删除key

作者: shaguamayi | 来源:发表于2018-12-17 10:18 被阅读0次
var arr=[{name:'',text:'',isedit:''},{name:'',text:'',isedit:''}]
for (var i = 0; i < arr.length; i++) {
                    delete arr[i]["isedit"];
 }
去除空对象
var zlxx=[{name:'af',text:'d'},{name:'',text:''},]
var zlresult = [];
                for (var i = 0; i < self.zlxx.length; i++) {
                    var obj = self.zlxx[i];
                    if (!!obj["name"] && !!obj["test"]) {
                        zlresult.push(obj);
                        delete self.zlxx[i]['isedit']
                    }
                }
console.log(zlreasult);

删掉isedit这个key

相关文章

网友评论

      本文标题:json数组删除key

      本文链接:https://www.haomeiwen.com/subject/mklqkqtx.html