flat
2023-06-16 10:28:26
ts
const _flatten = arr => {
const res = []
arr.map(item => {
if (Array.isArray(item)) {
res.push(..._flatten(item))
} else {
res.push(item)
}
})
return res
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11