7. What if choice1 is paper?


#1



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";}
}
}
else if(choice1==="paper") {
    if (choice2==="rock") {
    return "paper wins";}
    else {
   return "scissors wins";}
 }
 
Syntax Error!!! Please help!


#2

Hi all your code should be inside the compare function

var compare = function(choice1, choice2) { #open the compare function
    #here go your esle if statement
}#close the compare function

then this part you have more } than you need remove one }

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

then here you should add the closing } of the compare function

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

#3

Thank you for your explanation. It helps me a lot!