I'm currently try to learn the basics of JavaScript.
What I understood so far (and please correct me if I'm wrong somewhere): The language differentiates only between global and function scope.
Within functions you have to use the var-keyword when declaring function-wide variables. Otherwise you declare a global variable automatically.
But when I'm in the global space anyway:
Is it necessary to use the var-keyword there too?
I mean: I declare a global variable anyway.
So does it make sense to use var there too? And in case of so: Which sense?