I have 1.js, 2.js, test.html.
at the top of 1.js (outside of any function) I have var myvar="test"
at the top of 2.js (outside of any function) I have var myvar2
inside a function in 2.js I have:
myvar2="test2"
now inside test.html I can read myvar just fine but no myvar2.
Why not? Both are declared as global by declaring them outside any function right? If I fill myvar2 at the top of 2.js outside of a function I can read it from test.html. Any help?
at the top of 1.js (outside of any function) I have var myvar="test"
at the top of 2.js (outside of any function) I have var myvar2
inside a function in 2.js I have:
myvar2="test2"
now inside test.html I can read myvar just fine but no myvar2.
Why not? Both are declared as global by declaring them outside any function right? If I fill myvar2 at the top of 2.js outside of a function I can read it from test.html. Any help?
Comment