题解 | #数组扁平化#
数组扁平化
https://www.nowcoder.com/practice/5d7e0cf4634344c98e6ae4eaa2336bed
const _flatten = arr => {
// 补全代码
let res=[]
for(const v of arr){
if(typeof v =='object'){
res.push(..._flatten(v))
}else{
res.push(v)
}
}
return res
}
