Premium
Flatten with Depth
Challenge summary
Flatten nested arrays only to a requested depth while preserving item order and the source array.
What you'll practice
- Interpret zero, finite, and excessive depth values consistently.
- Preserve the left-to-right order of every retained item.
- Return a new array without mutating nested input arrays.
What Premium unlocks
Premium unlocks the runnable workspace, behavioral checks, implementation walkthrough, and edge-case discussion.
Free related practice
Upgrade to FrontendAtlas Premium to unlock this challenge. Already upgraded? Sign in to continue.