JavaScript applications have context, a scope where values are defined. The 'root' or 'global' object in the case of a browser is window.
The window object has a property (a variable) called document which stores a representation of the document. The document holds a model representation of the currently loaded document (such as title, anchors, etc). The window object represents the browser window where your document is displayed.
Also, if you in a script that is not in a function you define something like:
var x = 10;
Really what you have done is define a variable in the global object. In the browser case this will be in window.
So window.x will have the value of 10.