The real world is a messy place. Many of the problem domains we face as programmers are difficult to understand and look completely different depending on your viewpoint.
Programming is easy if you understand the problem domain
1-Make the problem domain easier 2-Get better at understanding the problem domain
Objects group together a set of variables and functions to create a model of a something you would recognize from the real world. In an object, variables and functions take on new names.
specifiehow browsers should create a model of an HTML page and how JavaScript can access and update the contents of a web page while it is in the browser window.
MAKING A MODEL OF THE HTML PAGE: When the browser loads a web page, it creates a model of the page in memory. The DOM specifies the way in which the browser should structure this model using a DOM tree.
The DOM is called an object model
because the model (the DOM tree) is
made of objects.
Each node is an object with methods and properties. Scripts access and update this DOM tree (not the source HTML file). Any changes made to the DOM tree are reflected in the browser.
STEP 1: ACCESSTHE ELEMENTS STEP 2: WORK WITH THOSE ELEMENTS
DOM queries may return one element, or they may return a Nodelist, which is a collection of nodes.
The browser represents the page using a DOM tree.
DOM trees have four types of nodes: document nodes, element nodes, attribute nodes, and text nodes.