reading-notes

Objects and DOM

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

the object has state, behavior, and identity. https://medium.com/techiepedia/how-to-explain-object-oriented-programming-oop-to-a-non-technical-person-9774ee26467e

What are some advantages to creating object literals?

The advantages of using object literals to create objects include convenience, flexibility in declaration, and less code during declaration. You can drop an object literal anywhere in your program with no previous setup and it’ll work https://codeburst.io/object-oriented-programming-in-javascript-51b2bdfdfe9f#:~:text=The%20advantages%20of%20using%20object,which%20can%20be%20very%20handy!

How do objects differ from arrays?

Arrays are best to use when the elements are numbers. objects are best to use when the elements strings https://www.geeksforgeeks.org/difference-between-array-and-array-of-objects-in-javascript/

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

Bracket notation is used when the property name is an invalid dot notation identifier. https://www.educative.io/answers/dot-vs-bracket-notation-when-accessing-a-javascript-object

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

he this keyword refers to the current object the code is being written inside.Well, when you only have to create a single object literal, it’s not so useful. But if you create more than one, this enables you to use the same method definition for every object you create. https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Basics

What is the DOM?

The Document Object Model (DOM) is a programming interface for web documents. It represents the page so that programs can change the document structure, style, and content. The DOM represents the document as nodes and objects; that way, programming languages can interact with the page. https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Introduction

Briefly describe the relationship between the DOM and JavaScript.

As an object-oriented representation of the web page, it can be modified with a scripting language such as JavaScript. https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Introduction