Last active
June 11, 2016 23:31
-
-
Save namikingsoft/e1a21c7358cf19408ebcf6a52fca6bf1 to your computer and use it in GitHub Desktop.
Flatten using reduce - reduce関数を使ってflattenを実現する
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
const flattened = [[0, 1], [2, 3], [4, 5]].reduce((p, x) => p.concat(x)); | |
// 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