JavaScript Statements Reference
Loop through the properties of an object:
The result of text will be:
The for/in statement loops through the properties of an object.
The block of code inside the loop will be executed once for each property.
JavaScript supports different kinds of loops:
Note: Do not use the for/in statement to loop through arrays where index order is important. Use the for statement instead.
Statement | |||||
---|---|---|---|---|---|
for/in | Yes | Yes | Yes | Yes | Yes |
Parameter | Description |
---|---|
var | Required. A variable that iterates over the properties of an object |
object | Required. The specified object that will be iterated |
JavaScript Version: | 1.0 |
---|
JavaScript Tutorial: JavaScript For Loop
JavaScript Reference: JavaScript for Statement