Created
December 25, 2017 20:52
-
-
Save davidicus/4a7530a55a7c2f419cfc6348327b7520 to your computer and use it in GitHub Desktop.
Flatten an array of arrays
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
var flattened = [[0, 1], [2, 3], [4, 5]].reduce( | |
( acc, cur ) => acc.concat(cur), | |
[] | |
); | |
// flattened is [0, 1, 2, 3, 4, 5] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment