Section 7 Unexpected token else


#1

There is a note separating the functional code of the previous section from the code that I'm getting an error from. I've checked several other help forms and cant see a problem with my code, please help.

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"}
//functional until here
else if(choice1 === "paper"){

    if(choice2 === "rock"){
        return "paper wins!";
        }
    else{
        return "scissors wins!";
        }

    }
}

#2

we have else if here:

else if(choice1 === "rock"){
  /* some code */
}

which contains a if and a else statement, agree? You forgot to close the else if with a }, where you put the comment: functional until here.

In case it wasn't obvious yet:

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

    if(choice2 === "scissors"){
    return "rock wins"}
}
else {
    return "paper wins"}
} <- this one is missing in your code, to close else if
//functional until here