8. What if choice1 is scissors?


#1

var compare = function(choice1, choice2) {
if(choice1 === choice2) {
return "The result is a tie!";

} else if(choice2 === "scissors") {
return "scissors wins";

} if(choice1 === "rock") {
return "paper wins";

} else if(choice2 === "rock") {
return "paper wins";

} if(choice2 === "scissors") {
return "scissors wins";

} else if(choice1 === "scissors") {
return "scissors wins";

} if(choice2 === "rock") {
return "rock wins";

} else if(choice2 === "paper") {
return "scissors wins";

}

}

It says that "paper wins" is returned instead of "undefined". Also says the same thing for "rock wins".


#2

That is a little nonsensical, yes, but if you consider what should be returned for that input, then you'll see that it is at least right about that your response is not what it should be.