Title:
JavaScript Objects
Updated:
November 8, 2023
Task/Activity:
- Questions
- Coding Problems
- What makes up an object (what does an object consist of)?
Properties, Events, and Methods
- What are two different types of notations that you can use when working with the properites of objects? For example, there are two types of syntax that you could use if you wanted to update a property of an object.
You can use either dot or bracket notation: myObject.name = object1 or myObject['name'] = 'object1'.
- Why are objects an important data type in JavaScript?
Because you can use them to have multiple instances of similar code that can both interact with each other and contain their own variations of data.
- When creating an object, what character is used to separate property names from their values?
A colon character.
- When creating an object, what character is used to separate the property/value pairs in an object?
A comma.
- What operator is used to access a property of an object?
The period, i.e. dot notation.
Coding Problems - See the 'script' tag below this section. You will have to write some JavaScript code in it.