var arr1 =[{id:1,name:1},{id:2,name:2},{id:3,name:3}]; var arr2 =[{id:1,name:111}]; var arr3 =[{id:4,name:44},{id:5,name:55}];比如原始数组是arr1,另外一个数组可能是arr2,也可能是arr3;怎么实现后面2个数组和arr1对比后,如果id重复了,就去重,如果id没有重复就合并成一个数组;类似如果和arr2对比:arr1就是:[{id:2,name:2},{id:3,name:3}];如果是arr3对比:arr1就是:[{id:1,name:1},{id:2,name:2},{id:3,name:3},{id:4,name:44},{id:5,name:55}];
添加回答
举报
0/150
提交
取消