Loading problem…
Implement a function that flattens a deeply nested array structure into a single-level array.
Your function should:
flatten([1, [2, [3, [4]], 5]]) // Output: [1, 2, 3, 4, 5] flatten([[1, 2], [3, 4], [5]]) // Output: [1, 2, 3, 4, 5] flatten([1, [], [2, [[[3]]]]]) // Output: [1, 2, 3]
3 hints available with Pro