`
list1 = [{id:1,name:'a'},{id:2,name:'b'}], list2 = [{id:1,name:'aa'},{id:2,name:'bb'},{id:3,name:'cc'}]
比较两个数组,怎么把list2里id为3对象push到list1里(list1里不存在的对象)
const resule = [...list1, ...list2.filter(item => !list1.some(r => r.id===item.id))]
1.4m articles
1.4m replys
5 comments
57.0k users