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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -