Skip to content

Instantly share code, notes, and snippets.

@amodig
Created April 5, 2016 10:31
Show Gist options
  • Save amodig/627f8c00d24b67bfe7922a4a342ba761 to your computer and use it in GitHub Desktop.
Save amodig/627f8c00d24b67bfe7922a4a342ba761 to your computer and use it in GitHub Desktop.
JS flatten array of arrays
var arrays = [[1, 2, 3], [4, 5], [6]];
console.log(arrays.reduce(function(a, b) {
return a.concat(b);
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment