先上代码
//合并两个数组
arr1.push(...arr2)//或者arr1 = [...arr1,...arr2]
//去重
let arr3 = Array.from(new Set(arr1)) //let arr3 = [...new Set(arr1)]
--by Affandi ⊙▽⊙
先上代码
//合并两个数组
arr1.push(...arr2)//或者arr1 = [...arr1,...arr2]
//去重
let arr3 = Array.from(new Set(arr1)) //let arr3 = [...new Set(arr1)]
--by Affandi ⊙▽⊙
本文标题:es6数组合并和去重
本文链接:https://www.haomeiwen.com/subject/vfclvktx.html
网友评论