📜  两个数组的并集 javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:55.898000             🧑  作者: Mango

代码示例3
// union of two arrays javascript (duplicate)
const union = (a, b) => Array.from(new Set([...a, ...b]));
console.log(union([1, 2, 3], [4, 3, 2]))
// output
 // [1, 2, 3, 4]