Help with code please


#1

So i've got a problem with my code in "rock, paper, scissors".
I can't find mistake in 2nd "else if" but i still get SyntaxError: Unexpected token else
Can someone help me lease? :slightly_smiling:

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

take a look at this code:

else if (choice1 === "rock"){
    if (choice2 === "scissors"){
    return "rock wins";
    }else {
    return "paper wins";
    } 
/* here */
else if (choice1 === "paper"){

your if (choice2 === "scissors") and else are nested inside else if (choice1 === "rock"), but you don't close your else if, before you next else if. I put a comment in the code above, it is where you should close your first else if


#3

i see it now. thank you! :slightly_smiling: