function unique(arr){
let res=[]
for(let i in arr){
if(res.indexOf(arr[i])===-1) res.push(arr[i])
}
return res
}
function unique2(arr){
return Array.from(new Set(arr))
}
function unique3(arr){
return [...new Set(arr)]
}
js数组去重
最新推荐文章于 2022-03-24 22:30:10 发布