看到一道小的面试题
// 输入数据const input = [ [1, 2, 2], [3, 4, 5, 5], [6, 7, 8, 9, [11, 12, [12, 13, [14] ] ] ], 10]// 输出数据expect = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]console.log([...new Set((input.flat(Infinity)).sort((a, b) => a - b))])new Set 去重f.
原创
2021-04-20 15:51:54 ·
96 阅读 ·
0 评论