Created
October 23, 2019 18:55
-
-
Save senthilmpro/09b3035487ad0e42378764c4199cc3ec to your computer and use it in GitHub Desktop.
Deep Flatten Array - Javascript
This file contains hidden or 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 deepFlatten(arr){ | |
return [].concat.apply([], arr.map(x => Array.isArray(x) ? deepFlatten(x) : x)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment