6/9 syntax error


#1

I can't find the error in my syntax. I used the hint and followed the code provided, that may be where the error is but I don't see it. Here is my code:

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" ;
}


#2

Haha you just need 2 extra brackets at the end, and one after your function. :smiley:


#3

Could you give me an example, please? I think I partially get what you're saying.


#4

Sure:

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";
}
}
}

#5

Thank you for you're help, it worked!