美文网首页
js如何遍历一个数组 并且删除不要的一项

js如何遍历一个数组 并且删除不要的一项

作者: Null丶sleep | 来源:发表于2020-09-12 15:42 被阅读0次
let arry  = [
     {
         ModifiedTime: "2020-09-07T15:45:47.0730572",
         code: "1111111",
         createdTime: "2020-09-07T15:45:47.0730476",
         createdUser: "兔子兄弟01",
         fieldName: "F2",
         id: "43aac108-528a-58df-517e-07c2115e91e0",
         modifiedUser: "兔子兄弟01",
         specificationName: "11111",
         specificationValue: "1",
         unit:"11",
     },
     {
         ModifiedTime: "2020-09-07T15:45:47.0730572",
         code: "1111111",
         createdTime: "2020-09-07T15:45:47.0730476",
         createdUser: "兔子兄弟01",
         fieldName: "F2",
         id: "43aac108-528a-58df-517e-07c2115e91e0",
         modifiedUser: "兔子兄弟01",
         specificationName: "11111",
         specificationValue: "1",
         unit:"11",
     }
 ]
arry.forEach(item => {
    for (let i in item) {
        if (i == 'specificationName'){
            delete item[i]
        }
    }
});
 console.log(arry);

相关文章

网友评论

      本文标题:js如何遍历一个数组 并且删除不要的一项

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