6.what if choice1 is rock? Help me i am so stuck


#1


Help me this is my code:

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 replies: Oops, try again. There was a problem with your syntax.


#2

I have found out were I went wrong if anyone wants the correct code this is it:
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";
}
}};


#3

You're missing an opening curly brace here.

Also, one more at the end of everything to close things up! :slight_smile:


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.