用二维数组实现矩阵的转置
// 翻转输出二维数组: [[1,2,3],[4,5,6],[7,8,9]]
function transpose(arr){
var newArr = [];
for(var i = 0;i < arr.length;i ++){
newArr[i] = [];
for(var j = 0;j < arr[i].length;j ++){
newArr[i][j] = arr [j][i];
}
}
console.log(newArr)
}
transpose( [[1,2,3],[4,5,6],[7,8,9]])