Recall & Review
beginner
What is an object in JavaScript?
An object is a collection of related data and functions (called properties and methods) grouped together. It represents real-world things with characteristics and actions.
Click to reveal answer
beginner
How do you create an object using object literal syntax?
Use curly braces {} with key-value pairs inside. Example:
{ name: "Alice", age: 25 }Click to reveal answer
intermediate
What does the
new Object() syntax do?It creates a new empty object. It's similar to using <code>{}</code> but less common. Example: <pre>const obj = new Object();</pre>Click to reveal answer
beginner
How can you add a property to an existing object?
You can add a property by assigning a value to a new key. Example:
obj.color = "blue";
Click to reveal answer
intermediate
What is the difference between object literal and constructor function for creating objects?
Object literal creates one object directly. Constructor functions let you create many similar objects using <code>new</code>. Constructor functions act like blueprints.Click to reveal answer
Which syntax creates an empty object in JavaScript?
✗ Incorrect
Curly braces {} create an empty object. Square brackets [] create arrays.
How do you access the property 'name' of an object 'person'?
✗ Incorrect
Use dot notation like person.name to access properties.
What does this code do?
const obj = new Object(); obj.age = 30;
✗ Incorrect
new Object() creates an empty object, then 'age' property is added.
Which is NOT a way to create an object in JavaScript?
✗ Incorrect
new Array() creates an array, not a general object.
What keyword is used with constructor functions to create new objects?
✗ Incorrect
The 'new' keyword creates a new object from a constructor function.
Explain how to create an object using object literal syntax and add a new property to it.
Think about how you write an object directly and then add something new.
You got /4 concepts.
Describe the difference between creating objects with object literals and constructor functions.
Consider when you want one object vs many similar objects.
You got /4 concepts.