//计算两个数组的交集
let a = [1, 2, 3, 4, 5, 6, 7, 8];
let b = [2, 4, 5, 6, 1];
let ex = a.filter(n => b.includes(n)); // 相交 b.includes(n) 不相交取反
console.log(ex);
//计算两个数组的交集
let a = [1, 2, 3, 4, 5, 6, 7, 8];
let b = [2, 4, 5, 6, 1];
let ex = a.filter(n => b.includes(n)); // 相交 b.includes(n) 不相交取反
console.log(ex);