JS20 数组扁平化 题解:递归数组判断 let newarr = [] const _flatten = arr => { // 补全代码 let i = 0; while(i < arr.length) { if (Array.isArray(arr[i])) { _flatten(arr[i]) } else { newarr.push(arr[i]) } i++ } return newarr }