All variables are global unless they are declared in a function.
Variables declared in a function is local to that function.
It is possible for two variables with the same name to exist if one is global and the other is local.
When accessing the variable within the function, you are accessing the local variable.
If the variable is accessed outside the function, the global variable is used.
Always use the var keyword to declare local variables in functions.