Say I declare a global JavaScript variable at the top of a JavaScript file to equal 0
i.e.
var jVar=0;
Then I call a function in the JavaScript to set that variable to 1 ie.
function setVarToOne(){
jVar=1;
}
If I then reload the page what will the variable equal before the setVarToOne
function is called ?
Will the jVar
keep the value it was set to in the function or will it be re-initialised to 0?
What I need to understand is, what happens to JavaScript variables when the page is reloaded?
Thanks