skip navigation

DOM manipulation

document.querySelector uses CSS selectors to select an element. This selects the first element it finds.

Text and void nodes cannot have child nodes. White space nodes are implied line breaks.

CSS style attributes do not include spaces instead they become camel case.

Events

When you need to pass arguments to an event listener, set it up in an anonymous arrow function.

When removing an event listeners it must be the same function used as in the addEventListern function. Functions must have a name.

Asyncs

Used in more modern code

Promises

Has three states, Pending, Resolved (returns a payload), Rejected (returns the error)

Created with a constructor like object.