题解 | #数组扁平化#
数组扁平化
https://www.nowcoder.com/practice/5d7e0cf4634344c98e6ae4eaa2336bed
const _flatten = (arr) => {
// 补全代码
let str = JSON.stringify(arr);
let str1 = str.replace(/\[|\]/g, "");
return JSON.parse("[" + str1 + "]");
};


查看8道真题和解析