DOM

the Document Object Model (DOM) is the convention for representing and interacting with objects in HTML documents.

the DOM is a representation of a web page in the form of an object, made up of properties that represent each of the document's child elements and subproperties representing each of those elements' child elements, and so on.

the DOM provides JavaScript with a map of all the elements on the page, and provides a set of methods for accessing those elements, their attributes, and their contents. JavaScript and the DOM form a powerful combination.

see JavaScript and the DOM working together to toggle the display.

helper methods

to find every p element on a page, we don't have to write out a string of property keys - we use a helper method built into document that gathers them all into an array-like list for us ("node lists").

methods return the element as an object, and then we can even check for a special class.

getElementById('intro') for all ids intro and getElementsByTagName('p') gives us a node list of all the paragraphs in the page.