题解 | #数组扁平化#
数组扁平化
https://www.nowcoder.com/practice/5d7e0cf4634344c98e6ae4eaa2336bed
function _flatten(arr){ const result = []; arr.forEach(item=>{ if(Array.isArray(item)){ result.push(..._flatten(item)); }else{ result.push(item); } }); return result; }