Skip to the content.

Code 102: Class 6 Reading Notes

JavaScript - Jon Duckett

Chapter 3: 3: “Object Literals” (pp.100-105)

Textbook notes/mostly direct quotes

*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.

Chapter 5: “Document Object Model” (pp.183-242)

The Document Object Model (DOM) specifies how 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.

You will hear people call the DOM an Application Programming Interface (API). User interfaces let humans interact with programs; APls let programs (and scripts) talk to each other. The DOM states what your script can “ask the browser about the current page, and how to tell the browser to update what is being shown to the user.

DOM trees have four types of nodes: document nodes, element nodes, attribute nodes, and text nodes.

You can select element nodes by their id or cl ass attributes, by tag name, or using CSS selector syntax

In older browsers, implementation of the DOM is inconsistent (and is a popular reason for using jQuery).