直接上代码,用到了filter和some
let arrA = [{id:1,age:21},{id:2,age:22},{id:3,age:23},{id:4,age:24}]
let arrB = [{id:1,age:21},{id:2,age:22}]
let arrC = arrA.filter(a=>!arrB.some(b=>b.id==a.id))
console.log(arrC)
打印结果:
直接上代码,用到了filter和some
let arrA = [{id:1,age:21},{id:2,age:22},{id:3,age:23},{id:4,age:24}]
let arrB = [{id:1,age:21},{id:2,age:22}]
let arrC = arrA.filter(a=>!arrB.some(b=>b.id==a.id))
console.log(arrC)
打印结果: