for (let y = 0; y < p.shape.length; ++y) {
for (let x = 0; x < y; ++x) {
[p.shape[x][y], p.shape[y][x]] = [p.shape[y][x], p.shape[x][y]];
}
}
여기서 shape는 그냥 2차원 배열임
shape =
{(2,0,0},
{2,2,2},
{0,0,0}}
[p.shape[x][y], p.shape[y][x]] = [p.shape[y][x], p.shape[x][y]];
이렇게 배열 바꾸는건 처음보네... 뭔의미인지 모르겠음
대충 봤을 때 transpose로 예상
걍 스왑같은데 저렇게 스왑하는게 트랜스포즈라고 부르나?
문법은 destructural assigmnent.
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
구조분해할당 해서 각 값을 해당하는 index의 변수에 대입함