Aaron Belz Aaron Belz - 7 months ago 38
HTML Question

JavaScript not using variables from other JS files

I'm pretty new to JS and I'm trying to pull variables from other files. I am having an issue with this though, I am importing all the JS files in what I have seen (looked around a lot before asking this) to be correct order. I also have tried using object creation like "Filename moduleName = new Filename();" then calling things set in that instance like "moduleName.variableName" this does not work either. I have made a Repl.it for this issue and here it is: https://repl.it/EGfc/5

If anyone has any suggestions, questions, comments or concerns please ask or say them!


Actually you have not declared the testForOne variable
in ContainsOne.js before the function. That's why it is undefined in Compile.js. I've made some changes in all your files to make clear how it works: