What if choice1 is rock?


#1

im stuck
here is my code
else if(choice1 === "rock"){
if (choice2 === "scissors") {
return "rock wins";
}
else {
return "paper wins";
}

But it dosent let me pass can someone help me


#2

What error does it throw at you? Seeing your code quickly, you started your if construct with an else if. It should be like this:

if condition:
    code to execute if true
else if condition:
    code to execute if true
else:
    code to execute

Hope this helps.


#3

when i try to pass it says
Oops, try again. There was a problem with your syntax.


#4

Looks fine. What's the rest of your code?


#5

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

}


#6

Looks good. Complete it with };


#7

yes that worked thank you