Flatten Nested Array
EPAMGlobalLogic
Write a function that flattens a nested array to a single level.
Example:
Input: [1, [2, [3, 4], 5], 6]
Output: [1, 2, 3, 4, 5, 6]
Examples:
Input 1:
{"arr":[1,[2,[3,4],5],6]}Output 1:
[1,2,3,4,5,6]Input 2:
{"arr":[1,2,3]}Output 2:
[1,2,3]Loading editor...
Run your code to see results
Click the Run button above