What if choice 1 is rock? (syntax error) help!


#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";
            }
        }

it keeps saying this; Oops, try again. There was a problem with your syntax.
what's the correct syntax anyone?


#2

You forgot an } to close the function.


#4

Where exactly? Could you please re-write the part were te mistake is coming from?


#5

Well at the very end one for the else, one for the else if and one for the function but in your case I can see only two }.


#6

i still don't get what you are saying?? the very last curly bracket closes the else if and the one before closes the else


#7

Yes so you need another one at the very end of your code to close the function as well. You need 3 you have 2.


#8

oh okay, it went through. Thanks so much!!!!