Help on What if choice1 is rock!


#1

Here is my code
/*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 compare = function(choice1, choice2){
if(choice1 === choice2) {
return console.log("The result is a tie!");
}

else if(choice1 === "rock") {

if(choice2 === "scissors") {
    return console.log("rock wins");
}
else {
    return console.log("paper wins");
}

};

then is says
SyntaxError: Unexpected end of input

could you please help me?


#2

This error message means there is an unclosed function body. The brace is there with the semi-colon, which is correct, so that means the ELSE IF statement is not closed. Add one more closing brace, just above the last one in you code.