Unexpected token else. What if choice 1 is rock?


#1



SyntaxError: Unexpected token else


var compare = function(choice1,choice2) {
if(choice1 === choice2) {
    return "The result is a tie";
}
{
else (choice1 === "rock") {

    if(choice2 === "scissors") {
        return "rock wins";
    }
}
    else if {
        return "paper wins";
    }

};


#2

You have 6 { and 5 } so if you add one I believe that will fix your problem. Specifically it would look like you need one around your return statement sense you have 3 { and only 1 } in that area.


#3

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