For/in is a special looping statement
that lets you display the property names (or properties' value) of
an object. Syntax:
for (variable in object)
statement
"variable" is any arbitrary variable that will hold the current
property of the object in question as it is being looped. Here are
two examples.
Example 1: This example writes out all the properties of
the "navigator" object:
for (myprop in navigator)
document.write(myprop+"<br>")
Example 2: This example writes out the properties, plus
their corresponding value, of the "navigator" object:
for (myprop in navigator)
document.write(myprop+": "+navigator[myprop]+"<br>")
|