Build "Rock, Paper, Scissors" 6/9


#1

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

Oops, try again. There was a problem with your syntax.

Can someone help me to spot my error? :sweat_smile:


#2

compare = function(choice1, choice2)
{
if (choice1 === choice2) {
return "The result is a tie!";
}
} delete this curly bracket

else if (choice1 === "rock") {
if (choice2 === "scissors") {
return "rock wins";
}
else {
return "paper wins";
}
}
add a curly bracket here

I am a novice but I think this could be the problem!


#3

Thank you so much! :relaxed:


#4

lol :smile: That is so funny.