Skip to content

Instantly share code, notes, and snippets.

@namikingsoft
Last active June 11, 2016 23:31
Show Gist options
  • Save namikingsoft/e1a21c7358cf19408ebcf6a52fca6bf1 to your computer and use it in GitHub Desktop.
Save namikingsoft/e1a21c7358cf19408ebcf6a52fca6bf1 to your computer and use it in GitHub Desktop.
Flatten using reduce - reduce関数を使ってflattenを実現する
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