Last active
December 15, 2016 15:42
-
-
Save nuragic/541c2e6de52ce9d4bde7a5cc9e9c3e97 to your computer and use it in GitHub Desktop.
ES6 Array Flatten
This file contains 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 = (arr) => arr.reduce((prev, current) => prev.concat(Array.isArray(current) ? flatten(current) : current), []); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment