Skip to content

Instantly share code, notes, and snippets.

@matiasfha
Created November 15, 2017 09:59
Show Gist options
  • Save matiasfha/980ad685e754a268dba581fce7b3f722 to your computer and use it in GitHub Desktop.
Save matiasfha/980ad685e754a268dba581fce7b3f722 to your computer and use it in GitHub Desktop.
ES6 Flatten Array
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