Complete the code to create an object representing a person with a name.
const person = { name: [1] }; console.log(person.name);The name value must be a string, so it needs quotes around it.
Complete the code to access the age property of the object.
const user = { age: 30 }; console.log(user.[1]);To get the age, use the property name 'age' after the dot.
Fix the error in the code to correctly add a new property to the object.
const car = {}; car[1]color = 'red'; console.log(car.color);Use dot notation to add a new property to an object.
Fill both blanks to create an object with a method that returns a greeting.
const greeter = { greet() { return [1] + this.[2]; } , name: 'Bob' }; console.log(greeter.greet());The method returns a greeting string plus the object's name property.
Fill all three blanks to create an object with properties and a method that uses them.
const book = { title: [1], author: [2], getSummary() { return `${this.[3] by ${this.author}`; } }; console.log(book.getSummary());The method uses the title and author properties to create a summary string.
