let arr = [1,1,2,2,3,3,4,4,5,5]
let newarr =Array.from(new Set(arr));
console.log(newarr) // [1, 2, 3, 4, 5]
***注意:区分number和string类型
let arr1 = [1,'1',2,'2',3,3,4,4,5,5]
console.log(Array.from(new Set(arr1))) //[1, '1', 2, '2', 3, 4, 5]
let arr = [1,1,2,2,3,3,4,4,5,5]
let newarr =Array.from(new Set(arr));
console.log(newarr) // [1, 2, 3, 4, 5]
***注意:区分number和string类型
let arr1 = [1,'1',2,'2',3,3,4,4,5,5]
console.log(Array.from(new Set(arr1))) //[1, '1', 2, '2', 3, 4, 5]