I'm testing out a rock paper scissor lizard spock game. Instead of generating the possible outcomes, I used var matrix = [ ] to capture all the possibilities. at array location matrix[3,0], the string entered was "rock wins". However, I ran console.log(matrix[3,0]) right after the array and it produced a different result.
can someone tell me why that is?
var matrix = [];
matrix[0,0] = "it's a tie";
matrix[0,1] = "Paper wins";
matrix[0,2] = "rock wins";
matrix[0,3] = "rock wins";
matrix[0,4] = "Spock wins";
matrix[1,0] = "Paper wins";
matrix[1,1] = "it's a tie";
matrix[1,2] = "Scissors win";
matrix[1,3] = "Lizard wins";
matrix[1,4] = "Paper wins";
matrix[2,0] = "rock wins";
matrix[2,1] = "Scissors win";
matrix[2,2] = "it's a tie";
matrix[2,3] = "Scissors win";
matrix[2,4] = "spock wins";
matrix[3,0] = "rock wins";
log.console(matrix[3,0]); //returns spock wins
matrix[3,0]doesn't do what you think, trymatrix[3][0].