PHP
·
发表于 5年以前
·
阅读量:8391
const intersection = (list, ...args) => list.filter(item => args.every(list => list.includes(item)))
console.log(intersection([2, 1], [2, 3])) // [2]
console.log(intersection([1, 2], [3, 4])) // []