第一种原生js写法:
let arr1 = [];
let arr2 = [1,22,1,33,33,22,44];
arr2.forEach(r=>{
if(!arr1.includes(r)) arr1.push(r)
})
console.log(arr1); //[1,22,33,44]
es6写法:
let arr = [...new Set([1,22,1,33,33,22,44])];
console.log(arr); //[1,22,33,44]