Skip to content

Instantly share code, notes, and snippets.

@erquhart
Created March 2, 2017 21:19
Show Gist options
  • Save erquhart/cfc3f82940d47c82c41e57e1f49f9628 to your computer and use it in GitHub Desktop.
Save erquhart/cfc3f82940d47c82c41e57e1f49f9628 to your computer and use it in GitHub Desktop.
function flatten(arr) {
return arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flatten(val) : val), []);
}
@erquhart
Copy link
Author

erquhart commented Mar 2, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment