J
Juan Garcia
I have a file acGlobals.js with only one declaration
acCount = 0;
I have a html file where I include acGlobals.js and use that
variable... ie.
acCount++;
alert(acCount);
Problem I see is that everytime I refresh the page alert displays a
"1". ALWAYS. So I figured, the global was being reinitialized to 0
when I reload the page.... fair enough. So i changed the declaration
in acGlobals.js to not initialize to 0. Just
acCount;
Then alert displays "NaN." What gives? I then repeated the
experiment but added the "var" to the declaration... Same result.
What kind of global is this?
Any ideas what is going on? What am I doing wrong?
jg
acCount = 0;
I have a html file where I include acGlobals.js and use that
variable... ie.
acCount++;
alert(acCount);
Problem I see is that everytime I refresh the page alert displays a
"1". ALWAYS. So I figured, the global was being reinitialized to 0
when I reload the page.... fair enough. So i changed the declaration
in acGlobals.js to not initialize to 0. Just
acCount;
Then alert displays "NaN." What gives? I then repeated the
experiment but added the "var" to the declaration... Same result.
What kind of global is this?
Any ideas what is going on? What am I doing wrong?
jg