(This is a copy of a post I made on Glitch.com here I posted it here too, because in the comments of the original post someone said I should put it here. I’m not trying to spam )
I have created a project where I am attempting to use multiple javascript files. I imported them into my html file and everything works as it is supposed to. However, if I try to use variables from one file in another file, I get an error message from Glitch saying that my variables aren’t defined. Given that my code runs as expected, this is a glitch with Glitch ( ). See my example here-https://humorous-simplistic-tuck.glitch.me/ In one.js I declared a variable, x, with a value of 5. In two.js I declared a variable, y, with a value of x+5 then console.logged y. As expected, “10” is logged to the console. However, in the editor Glitch still gives me an error saying x is not defined.