let a = [1, 2, 3]let b = [2, 3, 4]let intersect = a.filter(item => new Set(b).has(item)) // [ 2, 3 ] 交集let union1 = [...new Set([...a, ...b])] // [ 1, 2, 3, 4 ] 并集 或 数组去重let union2 = Array.from(new Set([...a, ...b])) // [ 1, 2, 3, 4 ] 并集 或 数组去重let difference = a.filter(item => !new Set(b).has(item)) // [1] b在a中的补集复制代码