A window is a root-level element in any web page, while a document is the direct child of the window object.
The global variables are defined on the window object, and documents are one of the properties of the window object. Document property can be accessed through windows or a document.