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


#1

https://www.codecademy.com/en/courses/javascript-beginner-en-Bthev-mskY8/0/4?curriculum_id=506324b3a7dffd00020bf661#

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";
    }
    else{
        return "paper wins";
    }
}

#2

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?


#3

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