var newArr = Array.from(new Set([1,2,2,3,4])) // 再把set转变成array

console.log(newArr) // [1,2,3,4]