I'm stuck... Please help


#1

I'm stuck on this excercise:
https://www.codecademy.com/courses/javascript-beginner-en-Bthev-mskY8/1/2?curriculum_id=506324b3a7dffd00020bf661#

This is the error message it's giving me:
SyntaxError: Unexpected token else

This is my code:

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

Please help


#4

The function body is still not closed, Add one more curly brace to the very end,and include a semi-colon on that brace only.

};

#6

Could you give me an example i dont quite understand where to put the curly bracket


#7

Actually there are two places where a brace is needed.

Should be,

if (choice1 === choice2) {  // note no semi-colon here

and at the end of the code, add };.


#8

Thank you very much :smiley:


#9

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.