标签:ack rem ati fun 数组 清除 var ice continue
//合并两数组,清除相同的项(长的数组放前面)
var removeDuplication = function (arrA, arrB) {
var i = 0, n = 0, lenA = arrA.length, lenB = arrB.length, _stack = [];
outSide: for (; i < lenB; i++) {
for (; n < lenA; n++) {
if (arrB[i].subId === arrA[n].subId) {
arrB.splice(i--, 1);
arrA.splice(n, 1);
n = 0;
lenA = arrA.length;
lenB = arrB.length;
continue outSide;
}
}
_stack.push(arrB[i]);
}
return _stack;
}
标签:ack rem ati fun 数组 清除 var ice continue
原文地址:http://www.cnblogs.com/Mie929094441/p/7447319.html