Created
November 9, 2019 21:45
-
-
Save peterforgacs/1b31d0209ac22e5ac097a06a5da7005c to your computer and use it in GitHub Desktop.
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
let arr = [ [1, 2], [3, 4]]; | |
// version 1 | |
arr.reduce((acc, curr) => acc.concat(curr), []); | |
// version 2 | |
arr.reduce((acc, curr) => [...acc, ...curr], []); | |
// version 3 | |
[].concat(...arr); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment