js如何对一个数组进行去重

function uniqueArr(arr) {
    return [...new Set(arr.flat(Infinity))]
}


let str = 'abccccccdddww'
console.log(uniqueArr(str.split('')))

let arr = [1, [1, 2], [1, 3]]

console.log(uniqueArr(arr))

posted on 2022-03-28 21:47  GameCat  阅读(23)  评论(0编辑  收藏  举报

导航