function flattenRecursion(arr) {
if (!arr.length) return [];
let res = [];
for (let i = 0; i < arr.length; i++) {
const item = arr[i];
if (Array.isArray(item)) {
res = [...res, ...flattenRecursion(item)];
} else {
res.push(item);
}
}
return res;
}
Top comments (0)
Subscribe
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)