Write a function that takes a nested array and returns a flattened version with all elements at a single depth level. The flattening should be recursive, going as deep as the array structure goes.
Examples
Input:[[1,[2,[3]]]]
Output:[1,2,3]
Input:[[1,2,[3,4],5]]
Output:[1,2,3,4,5]
Hints
Use recursion to handle arbitrary nesting depth.
Check if each element is an array - if so, flatten it first, then add its elements.
Use Array.isArray() to check if an element is an array.
Flatten
Implement a function that recursively flattens an array into a single level deep.