I'm stuck on this question: What if choice1 is paper?


#1

. The error message I'm getting is this:

Oops, try again.
Your code returned 'scissors wins' instead of 'paper wins' when the inputs are paper and rock

Below is the code. Can someone help me figure this out, it's driving me crazy because 'scissors wins' I believe is correct. Thanks in advance!

var compare = function (choice1, choice2) {
if (choice1 === choice2) {
    return "The result is a tie!";
}
else if (choice1 === "rock")
if(choice1 === "scissors") {
    return "rock wins";
}
else{
    return "paper wins";
}
else if (choice1 === "paper")
if (choice1 === "rock") {
    return "paper wins";
}
else{
    return "scissors wins";
}
};

#2

Took some time but I guess it this:

else if (choice1 === "paper")
if (choice1 === "rock") {

the inner one should check for choice2 not 1.


#3

nice one, this solved the problem and gave me inner peace :smile: