This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rotateArrayRight( arr ){ | |
// rotates a 2D array 90 degrees to the right (clockwise) | |
var newarr = []; | |
for( var x = 0; x < arr[0].length; x++ ){ | |
newarr[x] = []; | |
for( var y = arr.length - 1; y >= 0; y-- ){ | |
newarr[x].push( arr[y][x] ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let activities = [ | |
['Work', 9], | |
['Eat', 1], | |
['Commute', 2], | |
['Play Game', 1], | |
['Sleep', 7] | |
]; | |
function rotate( parameter ){ |