Ask coding questions

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

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 a professional code.


rediar (507)

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

avibeskrowni (153)

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 (153)

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

avibeskrowni (153)

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

3465728974563 (49)

@bgrubert hey I was wondering if you wanted to do a colab on this I have already started making my own version of this and was wondering if you would be interested in joining me and helping me out with adding stuff to this and making it a real game that people can play whenever they want. The progress I've made so far can be found here: ( . If you happen to be interested in this colab than just respond to this in some sort of way.

JustinPhillip (19)

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

3465728974563 (49)

@JustinPhillip If you try to put the images in the folder then he'll have to redo a whole bunch of code whenever it comes to the images because he'll have to add images/ or whatever he decides to name the folder and it's annoying and unnecessary