A Document object represents the HTML document that is displayed in browser’s window.
When we write an html and view it in a browser, browser turns in to a document object model.
The way a document content is accessed and modified is called the Document Object Model, or DOM.
In the DOM each element becomes an object or a node.
By using DOM we can dynamically change, add, or delete HTML elements.
The HTML DOM can be accessed with JavaScript and with other programming languages.
The window object represents an open window in a browser.
It is a global object .
It contains multiple properties and methods.
This window object contains document object.
When an HTML document is loaded into a web browser, it becomes a document object.
The document object is the root node of the HTML document.
If you want to check document object properties and methods, console.log(document)
wont be much helpful because it’ll give HTML structure. So use console.dir(document)
.