获取两个数组中不同的元素
作者:互联网
function getDistinct(array1, array2) {
var arr = [];
for (var i = 0; i < array1.length; i++) {
var obj1 = array1[i].tjsj;
var isExist = false;
for (var j = 0; j < array2.length; j++) {
var obj2 = array2[j].tjsj;
if (obj1 == obj2) {
isExist = true;
break;
}
}
if (!isExist) {
arr.push(obj1);
}
}
return arr;
}
标签:obj1,arr,array2,array1,元素,isExist,获取,数组,var 来源: https://blog.51cto.com/u_14302606/2817985