JavaScript Objects Worksheet

Question 1

What makes up an object (what does an object consist of)?

An object consists of key/value pairs. Each key is a property name, and each value is the data associated with that property.

Question 2

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.

The two types of notations are dot notation (object.property) and bracket notation (object["property"]).

Question 3

Why are objects an important data type in JavaScript?

Objects are important because they allow us to store and organize data in a structured way, making it easier to manage and manipulate related information.

Question 4

When creating an object, what character is used to separate property names from their values?

A colon (:) is used to separate property names from their values in an object.

Question 5

When creating an object, what character is used to separate the property/value pairs in an object?

A comma (,) is used to separate the property/value pairs in an object.

Question 6

What operator is used to access a property of an object?

The dot operator (.) is used to access a property of an object.

Coding Problems

Coding Problems - See the 'script' tag below this h3 tag. You will have to write some JavaScript code in it.