
Object Literal – Defines an object using key-value pairs. It's the most common way to create objects in JavaScript.
๐ Syntax
const person = {
name: 'John',
age: 30,
isAdmin: true
};
๐งช Example
const car = {
brand: 'Toyota',
model: 'Corolla',
year: 2020
};
console.log(car.brand);
Comments
Post a Comment