Unexpected End of Input


#1



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


So, this seems to be a regular problem with me; it says that I have an unexpected end of input, but I can't find it, it doesn't appear to have any extra '}' or ';'. the console says
"SyntaxError: Unexpected end of input"
and the error message says
"Oops, try again. There was a problem with your syntax."


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

Neither your else if not your function have their closing } so the program expects them and therefore the end of input comes unexpected.


#3

So my else if function is missing a }? or my else if and my function are?


#4

Hi its missing to your compare function and to the eslse if statetement


#5

You miss two "}" under your code. :stuck_out_tongue:


#6

Thank you! That makes much more sense!


#7

Thank you for your help!


#8

Thank you for your help and how quickly you responded!


#9

why is there another curly bracket at the end when it doesnt seem like it corresponds to another one?