利用ES6剩余参数加数组API forEach遍历每一个参数并加入到一个新数组中在遍历完成返回一个new Set处理后的新数组 ,这个新数组就是去重后的数组
let quchong = (...arr)=>{
let newArray = [];
arr.forEach((item, index)=>{
newArray = [ ...newArray, ...item ];
})
return [...new Set(newArray)]
}
let newArray = quchong([1, 2, 3], [3, 4, 5], [6, 7, 8, 9, 9, 9]) // 1,2,3,4,5,6,7,8,9