reading-notes

201 class 6 notes

Why this matters: This information matters because it introduces object syntax in JS, give us information about the Document Object Model (DOM), and includes articles on immutable and mutable data in JS.


JS Object Basics

Source: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Basics

1. How would you describe an object to a non-technical friend you grew up with?

In the JavaScript language, an object is a collection of data that is related in some way to one another. For example, data about a person, including their name, age, job, etc.

2. What are some advantages to creating object literals?

3. How do objects differ from arrays?

Objects don’t have indexes/index numbers; you instead use the name for each member’s value.

4. Give an example for when you would need to use bracket notation to access an object’s property instead of dot notation.

For example, you can’t use dot notation to access an object property name held in a variable - but you can access the value with bracket notation.

5. Evaluate the code below. What does the term this refer to and what is the advantage to using this?

this refers to the specific const declaration of dog, in this case, the data entered for name and age in this specific const (dog).

The advantage is that you can specifically target each value of the const/object by name.


Introduction to The DOM

Source: https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Introduction

1. What is the DOM? The DOM is the Document Object Model - the data representation of the objects that compromise the structure and content of a document on the web.

2. Briefly describe the relationship between the DOM and JavaScript.

The DOM is a Web API used to build websites - it’s not part of JS language. The DOM is what is able to access the JS document and its elements. The DOM isn’t a programming language, but it works with the JS input to create a model or notation of a given web page, HTML document, SVG document, and their component parts.


Things I Want To Know More About:

Nothing at the moment!