Created
September 22, 2021 17:36
-
-
Save kevinhooke/20a26c9ea1de04c4dd9767245b86d41d to your computer and use it in GitHub Desktop.
JavaScript flatten an array of arrays
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
let arrays = [ [1,2], [2,3], [3,4] ]; | |
let singleArray = [].concat.apply([], arrays); | |
//singleArray = [1, 2, 2, 3, 3, 4]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment