Please help 7/9


#1

What's wrong with my code? Please help
here's my code:

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

#2

I've looked at other ones, but it still doesn't work


#3
else {
return "paper wins";
}
else{
    return"scissors wins";
}

here you have 2 else directly following each other. Have a look at the hint of 6/9 to see how to construct an else if case for this game.


#4

thanks! I fixed it and it worked!