Created
November 15, 2017 09:59
-
-
Save matiasfha/980ad685e754a268dba581fce7b3f722 to your computer and use it in GitHub Desktop.
ES6 Flatten Array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const flatten = list => list.reduce( | |
(a, b) => a.concat(Array.isArray(b) ? flatten(b) : b), [] | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment