window.a is a property of window , and undefined. a is a variable, and it is not declared.
To use a variable, you must first declare it with the var statement. Since you did not declare a , the interpreter throws an error. To use the properties of objects, you do not need to explicitly specify them. Crockford writes in Good Parts:
If you try to extract a value from an object, and if the object does not have a member with that name, it instead returns undefined.
Török Gábor
source share