Ask coding questions

← Back to all posts
"Unexpected token else " error
bgrubert (86)

I have been working on this clicker game in html css and JS, but I am getting an unexpected token else error even though there seems to be nothing wrong.

Ps. Please note that I am only 11 so this is not going to be like a professional code.


Answered by avibeskrowni (29) [earned 5 cycles]
View Answer
avibeskrowni (29)

You are doing an else if to a function. You may want to change the else if to an if but I'm not sure what you're going for.

avibeskrowni (29)

or maybe indent that else if to make it line up with the if?

avibeskrowni (29)

P.S. Insanely amazing for an 11-year old.

bgrubert (86)

@avibeskrowni You are younger than me!

rediar (102)

amazing! I never really learned js, because of python flask, but now you're making me want to.

JustinPhillip (1)

just some advice: you might wanna sort out yout files, like put all your images into an "images" folder, etc.