6. What if choice 1 is rock? please help, thank you :)


#1



https://www.codecademy.com/en/courses/javascript-beginner-en-Bthev-mskY8/1/2?curriculum_id=506324b3a7dffd00020bf661#

it says SyntaxError: Unexpected token else ;( please help me find the errors, thanks a billion!


var compare=function(choice1,choice2)
{

     if(choice1===choice2)
    {
     return"The result is a tie!";   
    }
  
};

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


#2

Hi this part you close } the compare function before so you should remove one }

if(choice1===choice2)
    {
     return"The result is a tie!";   
    }
  
}; <== remove this one

Then here you should add one } for closing the compare function

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

} <== add one here

#3

it works now :))))thank you so so much!