1、使用es6的Set对象
let arr = [1, 2, 1, 3, 2];
let mySet = new Set(arr);
let newArr = [...mySet];
console.log(newArr); // 输出[1, 2, 3]
菜鸟教程es6 Set对象
2、使用for循环、forEach等循环将数组循环判断去重
1、使用es6的Set对象
let arr = [1, 2, 1, 3, 2];
let mySet = new Set(arr);
let newArr = [...mySet];
console.log(newArr); // 输出[1, 2, 3]
菜鸟教程es6 Set对象
2、使用for循环、forEach等循环将数组循环判断去重