rubengglez / flatten

Write an algorithm to flatten an arbitrarily nested array of values.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Part 1 – Flattening an array

Write an algorithm to flatten an arbitrarily nested array of values.

[ 1, [ 2, [ 3 ] ], 4 ] -> [ 1, 2, 3, 4 ]

If your language of choice includes a flattening function, please implement your own.

Versions

This kata was developed used node v17.3.0.

Tests

Jest framework was used in this repository to test the code. To run it, execute

    $ npm test

If you prefer watch mode, you can run

    $ npm run t-watch

About

Write an algorithm to flatten an arbitrarily nested array of values.


Languages

Language:JavaScript 100.0%