第一
console.log([...new Set(arr.flat(Infinity))].sort((a, b) => {
return a - b
}))
第二
var abb = arr.toString().split(',').sort((a, b) => {
a - b
}).map(Number)
const newAbb = [...new Set(abb)]
console.log(newAbb)
第三
var abb = arr.toString().split(',').sort((a, b) => {
a - b
}).map(Number)
const newAbb = [...new Set(abb)]
console.log(newAbb)
第四
function flatten(arr) {
while (arr.some(item => Array.isArray(item))) {
arr = [].concat(...arr)
}
return arr
}
var arr_f = [...new Set(flatten(arr))].sort((a, b) => {
a - b
})
console.log(arr_f)