I don't know what's missing



When trying to run this code I get error: "Oops, try again. There was a problem with your syntax."
Also in the console I get error message: "SyntaxError: Unexpected end of script" Please help.

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";


You are missing 1 closing curly-bracket-} at the end of your code
with which you close the ELSE-IF

Please read
and concentrate on:

  • the creation of the compare function
  • the truth-table
  • the build of the IF ELSE-IF statement structure as part of the compare FUNCTION-BODY
  • the execution of the compare function (keeping in mind that the return statement is used )


Thank you so much! I will read that post!