Created
June 23, 2017 01:31
-
-
Save arecvlohe/c8f9558867a9859df5d972d7f26bc40c to your computer and use it in GitHub Desktop.
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(array) { | |
return array.reduce((acc, curr) => { | |
if (Array.isArray(curr)) { | |
return flatten([...acc, ...curr]) | |
} | |
return acc.concat(curr) | |
}, []) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment