JavaScript 数组求并集
let arr1 = [1,2,3,4,5];
let arr2 = [4,5,6,7,8];
//数组求并集
function arrayUnion(arr1,arr2) {
return [...new Set([...arr1,...arr2])];
}
console.log(arrayUnion(arr1,arr2));
本文来自博客园,作者:重庆熊猫,转载请注明原文链接:https://www.cnblogs.com/cqpanda/p/17083290.html