Skip to content

Instantly share code, notes, and snippets.

@linglung
Forked from MauricioMoraes/one_level_flatten.js
Created November 7, 2019 15:37
Show Gist options
  • Save linglung/bae671871afca330363061cf30f2c826 to your computer and use it in GitHub Desktop.
Save linglung/bae671871afca330363061cf30f2c826 to your computer and use it in GitHub Desktop.
Javascript Flatten (for one level nested arrays) - Useful for google apps scripts on spreadsheets
// Takes and array of arrays matrix and return an array of elements.
function flatten(arrayOfArrays){
return [].concat.apply([], arrayOfArrays);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment