Constant syntax errors: "sketch.js:1 Uncaught SyntaxError: Identifier 'top' has already been declared"

javascript

#1

No matter what happens, I get syntax errors for all global variables with the message:

“sketch.js:1 Uncaught SyntaxError: Identifier [variableName] has already been declared”

My glitch.com sketch can be seen here:
https://adjoining-porpoise.glitch.me/

I believe this is a bug in glitch, am I right? Can it be fixed?

Thanks


#2

I don’t see the problem with all global variables, only specifically ‘top’. If you change that to a var or rename that variable to something different the error goes away. I can’t see where else top is being defined and used, but making that change will allow you to progress while I look into this some more.


#3

Yes changing it to var fixed it. Correct there was no other const top anywhere…