4. I've read through everything and I'm still stuck :/ Plz help


#1

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 (choice1 === "rock")
{
return "paper wins";
}
else {
return "scissors wins";
}
};


#2

You only need two closing brackets after this else statement not 3,

But here you need three,

brackets can be confusing sometimes :sweat_smile:


#3

Wow... thx for the help xD I feel so stupid now


#4

You're welcome :grin:


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.