let arr1 = [{uid:'1',name:'当当'},{uid:'2',name:'威威'} ]
let arr2 = [{id:'1',name:'当当',age:'20'},{id:'2',name:'多多',age:'23'},{id:'3',name:'丁丁',age:'24'}]
//ES6的方法,得到新数组
let newArr = arr2 .filter((item) => {
return !arr1 .some(ele=>ele.uid===item.id)
});
//ES5的方法,改变原数组
for (var i=0; i<arr2.length; i++) {
for (var j=0; j<arr1.length; j++) {
if (arr2[i].id == arr1[j].id) {
arr2.splice(i, 1);
}
}
}