Skip to content

Instantly share code, notes, and snippets.

@gkucmierz
Created December 9, 2016 05:35
Show Gist options
  • Select an option

  • Save gkucmierz/78ef64793afcd1bdda20e7bc36170a74 to your computer and use it in GitHub Desktop.

Select an option

Save gkucmierz/78ef64793afcd1bdda20e7bc36170a74 to your computer and use it in GitHub Desktop.
const flatten = arr => arr.reduce((res, el) => [...res, ...(Array.isArray(el) && flatten(el) || [el])], [])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment