Skip to content

Instantly share code, notes, and snippets.

@nuragic
Last active December 15, 2016 15:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nuragic/541c2e6de52ce9d4bde7a5cc9e9c3e97 to your computer and use it in GitHub Desktop.
Save nuragic/541c2e6de52ce9d4bde7a5cc9e9c3e97 to your computer and use it in GitHub Desktop.
ES6 Array Flatten
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