#1

What I've been doing is I've added a scoring system to the Rock Paper Scissors game (And repeat the game up to three times), but I've been getting some nasty syntax errors I can't seem to solve. Would anybody be as kind to help me out here?

``````var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
computerChoice = "rock";
} else if(computerChoice <= 0.67) {
computerChoice = "paper";
} else {
computerChoice = "scissors";
} console.log("Computer: " + computerChoice);

var computerPoints = 0;

var humanPoints = 0;

var compare = function(choice1, choice2) {
if (choice1 === choice2)
return "The result is a tie! Try again!"
else if (choice1 === "rock")
if (choice2 === "scissors")
return "Rock wins."
return "You win! (+1 point)"
humanPoints += 1
else
return "Paper wins."
return "Sorry to see you lose, try again!(+1 Computer points)"
computerPoints += 1
else if (choice1 === "paper")
if (choice2 === "rock")
return "Paper wins"
return "Wow! You win! (+1 Point!)"
humanPoints += 1
else
return "Scissors wins"
return "Looks like you got cut up.. Maybe if you tried again?.. (+1 Computer Points)"
computerPoints += 1
else if (choice1 === "scissors")
if (choice2 === "rock")
return "Rock wins"
return "Dang... Try again. (+1 Computer Points)"
computerPoints += 1
else
return "Scissors wins"
return "Wow! You won! Try to play again! (+1 Point!)"
humanPoints += 1
}

compare(userChoice, computerChoice)``````

Thank yall, and good Karma to those who help.

#2

The first thing that I can see is that you keep in mind that you can only omit the {} if your condition only targets the very next statement. As you often have 2 statements after if the else is treated as not connected. Wrote a longer post about this over here: