In this challenge you will be given a nested array, such as the following:
[1, [2, 3], [4, [5, 6]], [7, [8, [9, 0]]]]Just look at all those brackets... so confusing!
The goal is simple: write a function that turns a nested array as above into its flattened version, which in this example is:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 0]flatten([[6, 7], [4, 5]]) ➞ [6, 7, 4, 5]
flatten([[[[[["cat"]]]]]]) ➞ ["cat"]
flatten([[3, [5, 6]], [9, 3]]) ➞ [3, 5, 6, 9, 3]
flatten([1, [2, 3], [4, [5, 6]], [7, [8, [9, 0]]]]) ➞ [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]N/A