Open openks opened 6 years ago
let a=[1,2,3,4,5,6,7,8,9] let b=[0,2,4,6,8,10] // 并集 [...(new Set([...a,...b]))] //交集 a.filter(v=>b.includes(v)) //差集(也可以理解为并集-交集) a.concat(b).filter(v=>!a.includes(v)||!b.includes(v))