数组合并并且去重的方法

Last updated on January 18, 2023 pm

案例

1
2
3
const a = [1,2,5]
const b = [2,3,5,6]
//合并a和b并去重

解决方案

1
2
3
const c =[new Set([...a,...b])]
console.log(c)
//[1, 2, 5, 3, 6]

数组合并并且去重的方法
https://angelaggression.github.io/2023/01/18/数组合并并且去重的方法/
Author
BurnedWings
Posted on
January 18, 2023
Licensed under