Exercices

Estimated reading: 1 minute 81 views

Exercise 1: Creating and Accessing Properties

Create an object called car representing a car with properties like make, model, and year. Then, access and print these properties to the console.

Exercise 2: Adding and Modifying Properties

Extend the car object from Exercise 1 by adding a color property. Modify the year property to update the year the car was manufactured.

Exercise 3: Looping Through Properties

Create a function called printCarDetails that takes the car object as an argument and loops through its properties, printing each property and its value to the console.

Share this Doc

Exercices

Or copy link