What if choice1 is paper


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

It says that my code returned 'paper wins' instead of 'scissors wins' when the inputs are paper and scissors. Please help

What if choice1 is paper?.... help im confuse here!

It is not recommend to not use curly brackets for a if statement:

if (choice2 === "scissors") return "rock wins";


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

Now, you will see that your else:

else { return "paper wins";

is not inside your else if (choice1 === "rock")