6: Syntax Error: Unexpected token {


#1

Can someone help me identify where the unexpected { is?

Also, the code is not an identical copy of the example, so that could be a factor. :confused:



#2

close the if in your compare function. There's no closing bracket after the return statement.


#3

Hey @boardninja98849,

Have you forgotten how to write a function? That is not the write way to write one. More info here: https://www.codecademy.com/courses/javascript-beginner-en-6LzGd/0/3?curriculum_id=506324b3a7dffd00020bf661.

Sorry I don't know yet of how to put the website in one word yet. :sweat:

I'm going to go ask someone later.:smiley:

--EDIT--

I think there's a closing bracket after the return statement... I don't know.


#4

I'm not sure what you're saying


#5

It's that instead of the } being for the if loop here, it's more like in the function. Press the tab key once on that so it would look like it's for the if loop:

var compare = function**()**{
    if(userChoice ===  computerChoice){
    return "The result is a tie";
} <----bracket for the function, not if loop.

var compare = function**()**{
    if(userChoice ===  computerChoice){
    return "The result is a tie";
    } <----bracket for the if loop, not function

Look at the difference between those two. Look at the bottom one, which is the one you should do it as.