let A = [{id:1,num:2},{id:5,num:12},{id:10,num:4132},{id:55,num:42}]let B = [1,10]问题描述:根据B数组里面每个元素来筛选A里面的id字段对应的值,如果相同则删除.期望得到如下:[{id:5,num:12},{id:55,num:42}]
2 回答
白板的微信
TA贡献1883条经验 获得超3个赞
let A = [{id: 1, num: 2}, {id: 5, num: 12}, {id: 10, num: 4132}, {id: 55, num: 42}]let B = [1, 10]let C = A.filter(({id}) => B.indexOf(id) === -1);console.log(C)
添加回答
举报
0/150
提交
取消