摘要:
1.ES6的flat const arr = [1, [2, 3, [4, 5]]] arr.flat(Infinity) 2.递归 const arr = [1, [2, 3, [4, 5]]] const flat = (arr) => { let result = [] for (let i 阅读全文
摘要:
1、ES6 Set const arr = [1, 2, 1, 2, 3 ,4, 5] const unique = (arr) => { return Array.from(new Set(arr)) // return [...new Set(arr)] } unique(arr) 2、利用in 阅读全文