Is my code correct for this rock, paper scissors game?


What’s wrong with this? I keep getting an error even though I have checked the hints and its exactly the same. I have tried adding a ; at the very end of everything, still get the same error message that says syntax error: unexpected end of input

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


Please review the question, the url of the exercise you provided is from 4. computer choice: part 2

But the code you provided seems from a exercise further ahead. And what is the error message?


You have to close the compare function. The last closing bracket closes the if statement. Use one more closing bracket to close the function