About Lesson
You can access and modify object properties in two ways: dot notation or bracket notation.
Dot Notation
This is the most common way to access or modify properties.
Example:
JavaScript
let car = { brand: "Toyota", model: "Corolla" };
console.log(car.brand); // Output: Toyota
car.model = "Camry";
console.log(car.model); // Output: Camry
Bracket Notation
Bracket notation allows access to properties with variable names or property names that include special characters or spaces.
Example:
JavaScript
let person = { "first name": "Manjeet", age: 25 };
console.log(person["first name"]); // Output: Manjeet