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
// one line transpose array | |
// iterate over th elements of the first arra to dtermine the number of rows in the new array | |
// then iterate over the arrays of the original parent array to determine the number of columns and add the new values to the created array(s) | |
Array.prototype.Transpose = function() { | |
return this[0].map((elem1, indx1) => (this.map((elem2) => (elem2[indx1])))); | |
} |