Is there any difference between declaring a variable:
var a=0; //1
...this way:
a=0; //2
...or:
Keeping it simple :
a = 0
The code above gives a global scope variable
var a = 0;
This code will give a variable to be used in the current scope, and under it
window.a = 0;
This generally is same as the global variable.