function deduplicate(arr) {
// new Set方法数组去重,返回set数组,使用扩展运算符解构,重新封装成数组
let temp = [...(new Set(arr))]
return temp
}
数组去重es6语法new Set使用
最新推荐文章于 2025-06-10 16:31:44 发布
function deduplicate(arr) {
// new Set方法数组去重,返回set数组,使用扩展运算符解构,重新封装成数组
let temp = [...(new Set(arr))]
return temp
}
1593
257
1446
491
2638

被折叠的 条评论
为什么被折叠?