I have a square matrix (might be even or odd nr of items per side) and I wish to rotate it 180 degrees. That is rotate, not flip.
I have found many rotation by 90 degrees of varying shape but no luck finding one for 180 degrees. My matrix could be very large to make doing 2x 90 degree runs unacceptable.
Try the following:
grid.reverse().forEach(function(item) { item.reverse(); } );
console.log(grid);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.