Learn JavaScript
Loops
14.4
Lesson

for...in loop

A for...in loop is used to iterate over the properties of an object.

Let’s see the example given below, where we print all the properties of an object using a for...in loop:

In the example given above, we are iterating over the list of properties of the car object. During each iteration, the property currently being accessed is stored in the prop variable.