JS 两个数组的交集

var numOne = [0, 2, 4, 6, 8, 8];

var numTwo = [1, 2, 3, 4, 5, 6];

var numOne = [...new Set(numOne)]


var duplicatedValues = numOne.filter(
item => numTwo.includes(item)
);

console.log(duplicatedValues);

 

 

posted @ 2020-05-14 15:24  锋_锋  阅读(5424)  评论(0编辑  收藏  举报