mediumJavaScript

Flatten Nested Array

Given a nested array, flatten it into a single-level array. The function should support multiple levels of nesting. Example: Input: [1,[2,[3,[4]]]] Output: [1,2,3,4]
Ensure function signatures match starter code to run test cases.
index.js
Loading...

Test Case #1

Input: [1,[2,[3,4]]]

Expected: [1,2,3,4]

Test Case #2 (Hidden Case)

Input: [[1],[2],[3]]

Expected: [1,2,3]