js如何遍历一个数组 并且删除不要的一项
2020-09-12 本文已影响0人
Null丶sleep
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);