ES6数组去重方法

347 阅读1分钟

今天来写一个简单的ES6去重的方法

let arr = [1,2,3,4,5,5,5,5,5,6,7]

[...new Set(arr)]

console.log([...new Set(a)]) // [1, 2, 3, 4, 5, 6, 7]