Junior — Senior
Function that transforms a nested array into a flat list
livecode
Task condition
Implement a function that takes an array of arbitrary depth and returns a new array where all elements are at a single, flat level.
Example:
flatten([1, [2, [3, 4]], 5]); // => [1, 2, 3, 4, 5]
The function should work with any data types contained in the array and should not modify the original array.