A HTMLDocument Object Model, also called as DOM, houses every element of the HTML with respect to its order, and then JavaScript can access DOM to retrieve and change dynamically each element.
The document object
The document object represents a open HTML document in the browser, and when any HTML is loaded, it creates the document object, which can be accessed with JavaScript.
For example, using the document object, one can access a given element using its id, retrieving its content, and appending a new element to a page: