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]
本文标题:两数组对比过滤掉重复项
本文链接:https://www.haomeiwen.com/subject/qyfnphtx.html
网友评论