JavaScript Objects
In JavaScript, objects are king. If you understand objects, you understand JavaScript.
Creating an Object
You can create a JavaScript object using an object literal:
javascript
const person = {
firstName: "John",
lastName: "Doe",
age: 50,
eyeColor: "blue"
};Accessing Object Properties
You can access object properties in two ways:
javascript
person.lastName;
// or
person["lastName"];Test Yourself with an Exercise
How do you access the 'lastName' property of an object called 'person'?