![](https://img2018.cnblogs.com/blog/1853166/202001/1853166-20200127153022031-1596993502.png) ![](https://img2018.cnblogs.com/blog/1853166/202001/1853... ...
export default (arr) => {
// 獲取維度
let vecor = arr.length
// 垂直翻轉
for (let i = 0, len = vecor / 2; i < len; i++) {
for (let j = 0, tmp; j < vecor; j++) {
tmp = arr[i][j]
arr[i][j] = arr[vecor - i - 1][j]
arr[vecor - i - 1][j] = tmp
}
}
// 對角旋轉
for (let i = 0; i < vecor; i++) {
for (let j = 0, tmp; j < i; j++) {
tmp = arr[i][j]
arr[i][j] = arr[j][i]
arr[j][i] = tmp
}
}
return arr
}