I have been working on the scoring system for a game I am building with Javascript and have run into a problem. I am trying to compare the index 0 of a couple of arrays and return the index 1 of the array with the highest value.
This is what I have so far:
var player1 = new Array [1, "billy"];
var player2 = new Array [2, "jean"];
function checkWinner() {
var winner = Math.max(player1[0], player2[0]);
console.log(winner[1]);
}
checkWinner();