Lesson 6 what if choice1 is rock


#1



SyntaxError: Unexpected token else

Does anyone know what is incorrect about the code below?
I have been stuck here for a while please help!!!

The message that I revive is
SyntaxError: Unexpected token else

var compare=function(choice1,choice2){
    if (choice1 === choice2)
    return ("The result is a tie!")
}
else if (choice1 === "rock") {
    if(choice2 === "sicissors"){
        return "rock wins"
    }else{
        return "paper wins"
    }

}


#2

Always read twice what the error has to say! Seems like your syntax is not quite right, check the brackets and stuff :wink:


#3

if (choice1 === choice2) // missing {

see comment in code, that should help you further :slight_smile:


#4

Thank you I was able to find additional errors as well :slight_smile:


#5

i helped you with the error you where stuck at, and would have helped you further (same goes for root4af) but finding the additional errors yourself is much better :slight_smile:


#6