Error, expected an identifier and instead saw 'else'


#1


Rock Paper, Scissors


Expected an identifier and instead saw 'else'


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


#2

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

There ,can you see something unusual ?


#3

i'm specifically getting the error on line 19 else if(choice1 === "paper") ect...


#4

wow, removing that semicolon did the trick, thank you


#5

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