//reduce数组去重
let arr = [1,2,3,4,5,2,3]
let res=arr.reduce((pre,cur)=>{
if(!pre.includes(cur)){
pre.push(cur)
}
return pre
},[])
console.log(res)
//reduce数组去重
let newArr = Array.from(new Set(arr));
console.log(newArr);
......................
阅读全部 | 2019年12月31日 15:09