The browser creates a page structure
After reading HTML, the browser organizes the page into a structure it can work with. That structure is the DOM.
A beginner explanation of the DOM and why JavaScript can change what appears on a web page.
After reading HTML, the browser organizes the page into a structure it can work with. That structure is the DOM.
Because the DOM exists, JavaScript can change pieces of the page without rebuilding everything from scratch.
Pages with clear structure are easier to understand and easier for JavaScript to update cleanly.