Skip to content

Instantly share code, notes, and snippets.

@danielpradilla
Created October 6, 2018 23:50
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 danielpradilla/67f34c55a23c3a725677194a1dce19a0 to your computer and use it in GitHub Desktop.
Save danielpradilla/67f34c55a23c3a725677194a1dce19a0 to your computer and use it in GitHub Desktop.
transpose-in-javascript
/**
* http://www.codesuck.com/2012/02/transpose-javascript-array-in-one-line.html
*/
function transpose(a) {
return Object.keys(a[0]).map(function (c) {
return a.map(function (r) {
return r[c];
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment