const arr1 = [1,3,4,2,3,3,3,3,3]
const arr2 = [2,3]
const arr3 = [2,9]
const format = list => Array.from(new Set(list)) // 去重
const union = (a, b) => [...a, ...b] // 交集
const intersect = (a, b) => a.filter(e => b.includes(e)) // 并集
const difference = (a, b) => a.filter(e => !b.includes(e)) // 差集
const result = list => console.log(format(list))
// 两个数组
result(union(arr1, arr2))
result(intersect(arr1, arr2))
result(difference(arr1, arr2))
const mUnion = list => list.reduce((pre, now) => format(union(pre, now)))
const mIntersect = list => list.reduce((pre, now) => format(intersect(pre, now)))
const mDifference = list => list.reduce((pre, now) => format(difference(pre, now)))
// 多数组
const arrs = [arr1, arr2, arr3]
result(mUnion(arrs))
result(mIntersect(arrs))
result(mDifference(arrs))