In simple tests I've done, yes it does seem to be available
If you're setting the variable after loading main.js, then no, it won't be immediately available. If it's working in your tests, I'm guessing your code waits for the DOM ready event before running.
Originally Posted by OM2
But... what if I have a lot of other js code running in between
Does this change anything?
There's always the possibility that one of the scripts will overwrite your global variable. That's one of the problems with global variables.
If you're setting the variable after loading main.js, then no, it won't be immediately available. If it's working in your tests, I'm guessing your code waits for the DOM ready event before running.
There's always the possibility that one of the scripts will overwrite your global variable. That's one of the problems with global variables.
jeff, thanks for the reply
that's actually an amazing help
yes: someone else said to me that the dom waits for the ready event
the application is actually for jquerymobile
there'll be no chance of the code being over written - it's just got a unique name and a one off usage
question: let's say there is a lot of other js code that is loaded and run - is there ANY danger that the code might get executed BEFORE the dom loads? this is my concern
Bookmarks