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

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -