let arr =[
{
id:001,
name:"aaa",
age:13
},
{
id:002,
name:"bbb",
age:14
},
{
id:003,
name:"ccc",
age:15
}
]
let arr2 =[
{
id:001,
name:"ddd",
age:16
},
{
id:004,
name:"eee",
age:17
},
{
id:005,
name:"fff",
age:18
}
]
let arr3=[]
arr2.forEach(item=>{
if(arr.every(x=>x.id!=item.id)){
arr3.push(item)
// console.log(item)
}
})
let newarr = [...arr,...arr3]
//console.log(newarr)
let aee=[]
let aww=[]
aww = arr2.map(item=> { return item.id})
console.log(aww)
aee = arr.filter(x=>{
return ! aww.includes(x.id)
})
console.log(aee)
console