Open weijiyang opened 4 years ago
var arr = [1, [2,3,4,[2,3,4,5,[6,7]]]] Array.from(new Set(arr.flat(Infinity))).sort((a,b)=>{ return a-b}) arr.toString().split(",").sort((a,b)=>{ return a-b}).map(Number)
将数组扁平化并去除其中重复数据,最终得到一个升序且不重复的数组