Object Literals
Creating objects with literal syntax.
Examples
Creating an Object
Defining an object with multiple properties.
const person = {
firstName: "John",
lastName: "Doe",
age: 50,
eyeColor: "blue"
};
console.log(person.firstName);Empty Object
Creating an empty object and adding properties later.
const car = {};
car.make = "Toyota";
car.model = "Camry";
console.log(car);Test Your Knowledge
JavaScript Quiz
No quiz available for this topic yet.