Created
October 9, 2015 15:48
-
-
Save vlas-ilya/8a70e3a48f97345773a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var transpose = function (matrix) { | |
var result = []; | |
for (var i = 0; i < matrix.length; i++) { | |
for (var j = 0; j < matrix[i].length; j++) { | |
if (result[j] == undefined) result[j] = []; | |
result[j][i] = matrix[i][j]; | |
} | |
} | |
return result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment