Skip to content

Instantly share code, notes, and snippets.

@bhongy
Created February 1, 2018 04:17
Show Gist options
  • Save bhongy/8518f98806287b728e0ce5cc8777e698 to your computer and use it in GitHub Desktop.
Save bhongy/8518f98806287b728e0ce5cc8777e698 to your computer and use it in GitHub Desktop.
Simple Recursive Flatten Function in ES6
const flatten = xs => Array.isArray(xs)
? [].concat(...xs.map(flatten))
: xs;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment