← Back to challenges

Extremely Over-Nested

JavaScriptHardarraysformattingloops

Instructions

Create a function that returns the original value from a matrix with too many sub-arrays.

Examples

deNest([[[[[[[[[[[[3]]]]]]]]]]]]) ➞ 3

deNest([[[[[[[true]]]]]]]) ➞ true

deNest([[[[[[[[[[[[[[[[["innokodakademija"]]]]]]]]]]]]]]]]]) ➞ "innokodakademija"

Notes

You only need to retrieve one element.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: RegEx: Special Characters