View on GitHub

reading-notes

Johnston - Reading Notes - Home

Code 201, Foundations of Software Development

Class 06 - Reading Notes

   

Readings: Problem Domain, Objects, and the DOM

   

JavaScript Object Basics

JavaScript Object Basics

   

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

-  An object is a collection of related data and/or functionality. These usually consist of several variables and functions (which are called properties and methods when they are inside objects). 

What are some advantages to creating object literals?

-  It is very common to create an object using an object literal when you want to transfer a series of structured, related data items in some manner, for example sending a request to the server to be put into a database. Sending a single object is much more efficient than sending several items individually, and it is easier to work with than an array, when you want to identify individual items by name.

How do objects differ from arrays?

-  Objects represent a special data type that is mutable and can be used to store a collection of data (rather than just a single value). Objects are best to use when the elements strings (text).

-   Arrays are a special type of variable that is also mutable and can also be used to store a list of values. Arrays are best to use when the elements are numbers. 

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

-   If an object is defined at runtime, you can alternatively access it through bracket notation. 

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

-  The term `this` refers to the dog. It is directly referencing the object itself - taking that data and inserting it into the called part of the code.

   

Introduction To The DOM

Introduction To The DOM

   

What is the DOM?

- DOM stands for Document Object Model, it is a programming interface for web documents. The DOM represents the document as nodes and objects; that way, programming languages can interact with the page.  

Briefly describe the relationship between the DOM and JavaScript.

-   Javascript and DOM have a relationship that allows the page to work the way it does. Javascript reads Javascript but uses DOM to access content from the page. The DOM is not part of the JavaScript language, but is instead a Web API used to build websites. JavaScript can also be used in other contexts. DOM doesn't only have to interact with Java Script, as it can also be used to read other languages.

   

Things I want to know more about:

   

https://chrisjohnston1986.github.io/reading-notes/201class06reading