Medium20 min
Flatten an Array
Return a flat array containing all numbers from the nested input in their original order.
Your function
Implement solve(value, extra) in JavaScript. Return the answer; printing alone does not count as a result.
Examples
Input:
[[1,[2,[3]]]]Output:
[1,2,3]Input:
[[]]Output:
[]Constraints
Input contains at most 1,000 values or characters. Numbers are finite integers. Inputs follow the structure shown in the examples.