// set集合
let arr = [1,2,3,4,5,6,4,3,2];
// 去重
// let arr2 = [...new Set(arr)]
// console.log(arr2)
// 2交集
let arr2 = [1,2,3,4,8];
// let result = [...new Set(arr)].filter(item =>{
// let s = new Set(arr2)
// if(s.has(item)){
// return true
// }else{
// return false
// }
// });
// 简化
// let result = [...new Set(arr)].filter(item => new Set(arr2).has(item));
// console.log(result)
// 并集
// let union = [...new Set([...arr,...arr2])]
// console.log(union)
// 差集
let diff = [...new Set(arr)].filter(item => !(new Set(arr2).has(item)));
console.log(diff)
console