Skip to content

Instantly share code, notes, and snippets.

@shsunmoonlee
Created January 13, 2019 06:50
Show Gist options
  • Select an option

  • Save shsunmoonlee/f751db387ac67ee493e424feb56322dc to your computer and use it in GitHub Desktop.

Select an option

Save shsunmoonlee/f751db387ac67ee493e424feb56322dc to your computer and use it in GitHub Desktop.
flattenArray
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