massive noob here.
I'm making a rock paper scissor game in which one of the functions called 'game', counts the score between the player and the computer over 5 rounds.
The problem I am having is that no matter whether the player wins loses or draws, +1 is added to the score every time, instead of -1 for a loss and maintaining the score on a draw.
function game() {
var roundCount = 0;
var score = 0;
while (roundCount < 5) {
playRound(prompt("Rock, Paper or Scissors?"), computerPlay());
if (resultMessage == "You Win. Rock beats Scissors" || "You Win. Paper beats Rock" || "You Win. Scissor beats Paper") {
score++;
} else if (resultMessage == "Draw") {
score = score;
} else {
score--;
}
console.log(score)
roundCount = roundCount + 1;
}
return score;
}
console.log(game());