function displayTransposeMatrix(matrix) {
const rows = matrix.length;
const cols = matrix[0].length;
for (let i = 0; i < cols; i++) {
let s = "";
for (let j = 0; j < rows; j++) {
s += matrix[j][i] + " ";
}
console.log(s);
}
}
const matrix = [ [9, 0, 7, 1],
[4, 5, 6, 3],
[2, 8, 4, 0] ];
displayTransposeMatrix(matrix);
/*
run:
9 4 2
0 5 8
7 6 4
1 3 0
*/