javascript - Codecademy "SyntaxError: Unexpected token else" -


i'm doing codecademy js course, , i'm @ part rock paper scissors. when save code says "syntaxerror: unexpected token else". did wrong? code:

var compare = function(choice1, choice2) {     if (choice1 === choice2)     {         return("the result 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");         }     }     else if (choice1 === "scissors")     {         if (choice2 === "paper");         {             return ("scissors wins");         }         else         {             return("rock wins");         }     } } 

remove semicolon after if/else if/else

for e.g.

   else if (choice1 === "paper"); 

Comments

Popular posts from this blog

gcc - MinGW's ld cannot perform PE operations on non PE output file -

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

c# - Search and Add Comment with OpenXML for Word -