Open roxy0724 opened 4 years ago
var a = [1, 2, [3, 4, [5, 6, [7, 8, [9, 10]]]]]
function merge(arr) {
return arr.reduce((a, b) => {
if (Array.isArray(b)) {
return [...merge(b), ...a]
} else {
return [b, ...a]
}
}, [])
}
merge(a)
same as #130