Now we know about objects we can introduce another kind of loop.
for (
variablein
object)
statement
variable can be anything suitable for the left side of an assignment.
object is a named object or an expression resulting in an object.
NB: This will not list built-in properties of the object, only user-created ones.
for (var prop in myObj)
{
document.write ("name: " + prop + ", value: " + myObj[prop] + "<br>");
}
That lists all properties of myObj