两数组对比过滤掉重复项
2020-04-07 本文已影响0人
coderfl
const xx = [1,2,3];
const yy = [1,2,3,4,5];
const b = yy.filter(value => xx.indexOf(value) < 0);
console.log(b) // (2) [4, 5]
const xx = [1,2,3];
const yy = [1,2,3,4,5];
const b = yy.filter(value => xx.indexOf(value) < 0);
console.log(b) // (2) [4, 5]