What if choice1 is paper?: Unexpected Token Else Error


#1


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


When trying to add the step "What if choice1 is paper?", I keep getting the following error message:

Error Message: SyntaxError: Unexpected token else

I've checked my curly brackets, rewritten it repeatedly, and even gone so far as to copy my code from the previous step "What if choice1 is rock?" (which had worked fine) and replace the rock/paper/scissors terms and still no dice. What am I doing wrong?


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"){
    if(choice2 === "scissors"){
        return "rock wins";
    }
    else{
        return "paper wins";
    };
};

closing curly brackets (}) of if, else if and else should not have semi-colons


#3

Ah, HA. The site didn't catch it as an issue on the previous step so I hadn't considered that as an issue. Thanks so much!


#4