All challenges

JavaScript challenge · Frontend

Flatten

Difficulty

easy

Time

~15m

Format

Single

Grading

Auto-graded

#frontend#javascript#typescript#arrays#recursion
Mission file // read carefullyeasy

Implement flatten(arr) that takes a deeply nested array of numbers and returns a single flat array, in order. Do not use Array.prototype.flat.

flatten([1, [2, [3, [4]], 5]]) // => [1, 2, 3, 4, 5]

Build with

TypeScriptJavaScript
Hidden test suite
Auto-graded on submit
Start challenge

Sign in to save your progress.