Transposes a matrix (2D array) by converting rows into columns and columns into rows
The input matrix type (2D array of primitives)
Helper type representing the first row of the matrix (default: M[0])
type Matrix = [ [1, 2, 3], [4, 5, 6]];Transpose<Matrix>; // Result: [[1, 4], [2, 5], [3, 6]] Copy
type Matrix = [ [1, 2, 3], [4, 5, 6]];Transpose<Matrix>; // Result: [[1, 4], [2, 5], [3, 6]]
Transposes a matrix (2D array) by converting rows into columns and columns into rows