Skip to content

Instantly share code, notes, and snippets.

@kevinhooke
Created September 22, 2021 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinhooke/20a26c9ea1de04c4dd9767245b86d41d to your computer and use it in GitHub Desktop.
Save kevinhooke/20a26c9ea1de04c4dd9767245b86d41d to your computer and use it in GitHub Desktop.
JavaScript flatten an array of arrays
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