Created
October 19, 2016 11:33
-
-
Save subtainishfaq7175/8fdc07011177b4e2d2f40173a6d48855 to your computer and use it in GitHub Desktop.
flatten the array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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