Skip to content

Instantly share code, notes, and snippets.

@albulescu
Created June 1, 2016 11:40
Show Gist options
  • Save albulescu/5ff7b7fcdbe4875690b969dd01342a2e to your computer and use it in GitHub Desktop.
Save albulescu/5ff7b7fcdbe4875690b969dd01342a2e to your computer and use it in GitHub Desktop.
const flatten = arr => arr.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