JAVASCRIPT
JAVASCRIPT ) 전치행렬
Hweb
2024. 8. 26. 16:50
let a = [
[1,2,3],
[4,5,6],
[7,8,9]
]
let b = a.map((i)=>[...i]);
for(let i=0; i<a.length; i++){
for(let j=0; j<a[0].length; j++){
b[i][j] = a[j][i];
}
}
console.log(a);
console.log(b);
반응형