Excercise 7 syntax error


#1

Hello
I get the following error: SyntaxError: Unexpected token {

I can't find the syntax error.
thanks for your help.

/*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 "The result is a tie!";    
} else if (choice1 === "rock") {
    if (choice2 === "scissors" {
        return "rock wins";    
    } 
    else {
        return "paper wins";    
    }
} else if (choice1 === "paper") {
    if (choice2 === "rock") {
        return "paper wins";    
    }
    else {
        return "scissors win";    
    }
} 
};

#2

you missing the closing )


#3

oh well :smiley:
thanks for your help it's working now.


#4

You're welcome :green_heart:

Happy Learning :slightly_smiling:
Happy coding !

What inspired you to learn programming/coding?
Join the discussion