Skip to content

Instantly share code, notes, and snippets.

@subtainishfaq7175
Created October 19, 2016 11:33
Show Gist options
  • Save subtainishfaq7175/8fdc07011177b4e2d2f40173a6d48855 to your computer and use it in GitHub Desktop.
Save subtainishfaq7175/8fdc07011177b4e2d2f40173a6d48855 to your computer and use it in GitHub Desktop.
flatten the array
function flatten(arg) {
const flatit = [].concat(...arg);
return flatit.some(Array.isArray) ? flatten(flatit) : flatit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment