7. What if choice 1 is paper


I keep getting a syntax error, but it doesn't specify where or what the error is, just that there's an error. I've rewritten my code multiple times and tried just copying and pasting the code that worked in the last exercise and changing the strings as necessary with no luck.

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 wins");


clever to try to leave out some {}, can be a bit risky unless you do it right.

anyway, here:

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

the semi-colon on this line prevents the else if statement from working properly, remove the semi-colon and you should be good to go


Wow. I can't believe I missed that. Thanks!