I have no idea what's wrong with my syntax here for the rock, paper, scissors game in Javascript


#1

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

#2

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

Try changing it to :

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


#3

You also seem to miss a } for the function.