Create an object representing a book with title, author, and year properties. Change the year to a new value, then log the updated object.
Objects let you group related data and functionality into key–value pairs. Each property has a name (key) and a value.
let person = {
name: "Alice",
age: 25,
job: "Developer"
};
console.log(person.name);
console.log(person["age"]);
person.age = 26;
person.country = "USA";
let car = {
brand: "Toyota",
drive: function() {
console.log("Vroom!");
}
};
car.drive();