JS-两个数组合并后获取未重复的值
var projectsId=[1,2,3,4,5,6,add,7,8],newArr=[1,2,3,5,7,8,10], arr3=[]; for (var key = 0; key < projectsId.length; key++) { var stra = projectsId[key]; var count = 0; for (var j = 0; j < newArr.length; j++) { var strb = newArr[j]; if (stra == strb) { count++; } } if (count === 0) { arr3.push(stra); } }; console.log(arr3)