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