JavaScript’s for
loop is the same as that in C and Java: it lets you provide the control information for your loop on a single line.
JavaScript also contains two other prominent for loops: for
…of
and for
…in
For of
For in
The for...in
statement iterates a specified variable over all the enumerable properties of an object. For each distinct property, JavaScript executes the specified statements. A for...in
statement looks as follows: