What if Choise 1 is paper?


#1

Hi , Im really experiencing problems to past this part, please help me , the computer says: Unexpected token else

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

else { return "paper wins"}

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

`


#2

This topic will guide you to fix it. It's a syntax error, unexpected token. It has to do with how you wrote your code, you're missing a curly bracket causing the else token to be unexpected when it was expecting a closing bracket. There is a tool that will show you where in the topic.


#3

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