7 choice1 paper --syntax?


#1

Ive been on tons of number 7 topics yet I cannot get why this will not go through! It says Syntax error, and "Unexpected Token else", can someone tell me which one it is or what im doing wrong aaahh! thanks.

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

@boodlepop here is your code i have commented on where the mistakes were

var compare = function(choice1, choice2){
                if (choice1 === choice2){
                    return "The result is a tie!";
                } 
                else if (choice1 === "rock") {
                    if (choice2 === "scissors"){//missing this brace
                        return "rock wins";
                    } 
                    else {return "paper wins";}
                }// missing this brace
                else if(choice1 ==="paper"){
                    if (choice2 ==="rock") {
                        return "paper wins";
                    } 
                    else {
                        return "scissors wins";
                    } 
                }
            };//close compare function (missing this one)

#3

thank you! i hate those little suckers always add too many or missing some.