Skip to content

Instantly share code, notes, and snippets.

@okiroth
Created April 22, 2016 17:22
Show Gist options
  • Save okiroth/11558b0e7037378a32c48dad7c87783e to your computer and use it in GitHub Desktop.
Save okiroth/11558b0e7037378a32c48dad7c87783e to your computer and use it in GitHub Desktop.
flatten array in javascript
var result = [];
for (var i = 0; i < source.length; ++i) {
for (var j = 0; j < source[i].length; ++j)
result.push(source[i][j]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment