"What if choice1 is 'paper'?"


#1

This is the code that I've entered and I keep getting a syntax error. What am I missing? Thank you!

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

}

};


#2

Hi first in your first else if statement at the closing "}" remove the ";" and in your second else if statement your have more "}" you should remove one .


#3

Thank you, very much!


#4

A post was split to a new topic: Edit this title