Exercise 2: Let's iterate!

In this exercise, you will be required to iterate through the properties of the object created in the previous lesson.

We'll cover the following

Problem Statement

In this exercise, you’re already given the object product from the previous exercise with the properties and their values. You need to iterate through the object and change the value of:

  • name to Bottle
  • madeIn to China

You need to do the above-mentioned task in the display function given below. We are using that function for testing purposes so no need to worry. Just write the implementation code there.

Note: For more practice try solving this question using both dot notation and square brackets in order to access properties of the object.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy