For…In Loop
The for…in loop is used to loop through an object’s properties.
Syntax
for (variablename in object){ statement or block to execute }
In each iteration, one property from the object is assigned to variablename and this loop continues till all the properties of the object are exhausted.
Example
Try the following example to implement the ‘for-in’ loop. It prints the web browser’s Navigator object.