数组比较取值根据需求分为取单个值和取多个值
单
```javascript
let c = [];
let tmp = arr1.concat(arr2);
let o = {};
for (let s = 0; s < tmp.length; s++) {
(tmp[s] in o) ? o[tmp[s]]++ : o[tmp[s]] = 1;
}
for (let x in o) {
if (o[x] == 1) {
c = x;
}
}
多
```javascript
arrayRepeat(array1, array2) {
let c = [...array1, ...array2],
d = new Set(c),
e = Array.from(d),
f = [...e.filter(_=>!array1.includes(_)),...e.filter(_=>!array2.includes(_))]
return f
},
版权声明:本文为ghyxx原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。