Syntax Error: Unexpected token else D:


#1

Stuck on #7 What if choice 1 is paper?

Can someone look over mine and see where I'm incorrect? Thank you in advance.

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

Where's your closing tag for else if ?


#3

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