When a web page is loaded, the browser creates a Document Object Model of the page.

The HTML DOM model is constructed as a tree of Objects:

html_dom.jpg

✅ What is document?

✅ Is document an object?

Yes.

It is a JavaScript object with many properties and methods.

You often use it like this:

document.getElementById("myId");
document.querySelector(".my-class");
document.title;

✅ What does the DOM do?

The DOM (Document Object Model) does not change your original HTML file, but it creates a live object-based version of your HTML that JavaScript can read, modify, or delete.

Think of it like this: