reading-notes

Duckett JavaScript book Chapter 3 : Object Literals

WHAT IS AN OBJECT?

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.

Like variables and named functions, properties and methods have a name and a va lue. In an object, that name is called a key. An object cannot have two keys with the same name. This is because keys are used to access their corresponding values. The value of a property can be a st ring, number, Boolean, array, or even another object. The va lue of a method is always a function.

img1


Duckett JavaScript book Chapter 5 : Document Object Model

THE DOM TREE IS A MODEL OF A WEB PAGE

As a browser loads a web page, it creates a model of that page. The model is called a DOM tree, and it is stored in the browsers’ memory. It consists of four main types of nodes.

dom tree

  1. THE DOCUMENT NODE.
  2. ELEMENT NODES.
  3. ATTRIBUTE NODES.
  4. TEXT NODES.

WORKING WITH THE DOM TREE

Accessing and updating the DOM tree involves two steps:

  1. Locate the node that represents the element you want to work with.
  2. Use its text content, child elements, and attributes.