用递归的方法扁平化数组 前端小菜鸡123 2023-03-05 51 阅读1分钟 // 扁平化数组 export function flatten(arr) { return arr.reduce((res, next) => { return res.concat(Array.isArray(next) ? flatten(next) : next) }, []) }