let arr = [{
name:1,
data:[{
a:'1',
b:'2'
}]
},
{
name:1,
data:[{
a:'11',
b:'2'
}]
}
]
let tmpResult = []
arr.forEach((rules,index)=>{
tmpResult[index] = rules
tmpResult[index].data = rules.data.filter((item) => {
return item['a'].includes('11')
})
})
console.log(tmpResult,arr);
打印后的arr不是原来的arr