数组巧去重new Set时间:2023-01-28 19:12:52let arr = [ 1 , 2 , 2 , 3] ; let set = new Set(arr) ; let newArr = Array. from(set) ; // Array.from方法可以将 Set 结构转为数组。 console. log(newArr) ; // [1, 2, 3]