What if choice1 is rock?


#1

I can't see whats wrong here, please help!

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 === "rock")
if (choice2 === "scissors") {
return "rock wins";
}
else {
return "paper wins";
}
};


#2

You are repeating yourself! Remember D.R.Y. :slightly_smiling:

Your first else if statement else if (choice1 === "rock") { is correct, but your following else if should account for choice1 === "paper" instead of repeating for "rock".