Reading Journal
This topic is important because it allows us as coders to keep objects simplified, organized, and easy to understand. This aids in debugging as well as readability. The DOM is also important to understand because it allows us to interact with the webpage through various code commands. As we change code, the DOM makes the appropriate changes on the rendered site.
Reading
JavaScript Object Basics
1. How would you describe an object to a non-technical friend you grew up with?
- An object is just a container that holds different pieces of information. The information in that container can be representative of many different things. When the computer needs to find specific information, it looks within the object, and finds the specific data it needs to do its job. This JavaScript object can hold many different types of data within it. This is how we are able to keep things organized within our JavaScript file.
2. What are some advantages to creating object literals?
- They are easier to read because the information is often declared in such a way that is self explanatory, this allows for greater organization within the file. In the exact definition of a literal object, the object is literally described in a simple manner that aids in efficiency for the computer and coder.
3. How do objects differ from arrays?
- Objects contain key-value pairs and the data within the object can be any data type. This data can also be extracted in any order,whereas the data in arrays is generally ordered in a sequential order and can be extracted by calling a number representing the element.
4. Give an example for when you would need to use bracket notation to access an object’s property instead of dot notation.
- While dot notation is generally easier to read over bracket notation, you would want to use bracket notation if you were calling a property name that contained spaces or began with a number. In these special cases, dot notation simply won’t work.
5. Evaluate the code below. What does the term this refer to and what is the advantage to using this?
This is used to refer to the object which in this case is “dog”. After this a dot is used to reference the assigned property. This also allows the properties to be changed if necessary without modifying the method.
Introduction To The DOM
1. What is the DOM?
- The DOM (Document Object Model) allows computers and web developers to read, edit, and interact with the web pages.
2. Briefly describe the relationship between the DOM and JavaScript.
- The DOM is the structure that allows you to view and manipulate web pages. JavaScript is the programming language that allows you to modify and interact with the DOM in real time.
Things I want to know more about.
- I can’t wait to see how this all comes together. I read ahead and the Salmon Cookie challenge seems intense!