What's wrong?


#1


https://www.codecademy.com/en/courses/javascript-beginner-en-Bthev-mskY8/1/3?curriculum_id=506324b3a7dffd00020bf661#

I don't know what's the problem, since in the previous lesson a similar one was working. It says: "SyntaxError: expected expression, got keyword 'else'". Can someone help, please?


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


#2

Hi this part you forgot to close the else if statemnt

 else if(choice1 === "rock") {
        if (choice2 === "scissors") {
            return "rock wins";
        } else {
            return "paper wins";
        }
} <== add one here

#3

Thank you very much! :slightly_smiling: