.7 what if choice1 is paper? need help


#1

I need help. This is for rock paper scissors.


I keep getting "unexpected token 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";
}
}
};
compare("paper", "scissors")


#2

remove the semicolon and try adding another curly brace after the else statement. if it doesn't work then could you send me a link?


#3

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