I don't know what's missing


#1



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


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


#2

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

Please read
http://www.codecademy.com/forum_questions/559dcb4be39efe550f00006b
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 )

#3

Thank you so much! I will read that post!