将一个数字扁平化,去重并升序

const _arr = [[21,213],[1,43,125,89],[[23,54],90,389],12];

[...new Set(_arr.flat(Infinity))].sort((a,b)=>{
    return a-b
})
(11) [1, 12, 21, 23, 43, 54, 89, 90, 125, 213, 389]

 

posted @ 2019-07-23 22:44  陈小银  阅读(188)  评论(0编辑  收藏  举报