JavaScript Objects Worksheet

Question 1

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

Property name and property value also known as Key/Value pairs

Syntax:
let/const variableName = { 
    (Property name): Property value, <- comma to seperate each pair
    (Property name): Property value
};          

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.

You can do console.log(variableName) to get all of the properties of the variable or you can do console.log(variableName.propertyName) to get just the specific property information.

You can use the variable name itself or you can use the dot operator: . to get the specific property name. Example: .proptetyName

Question 3

Why are objects an important data type in JavaScript?

Objects are made up of other data types. Objects can have the other data types stored in them as property values.

Question 4

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

Colon ( : )

Question 5

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

Comma ( , )

Question 6

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

Dot operator ( . ) which is used like this: variableName.propertyName

Coding Problems

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