August 1999
Intermediate to advanced
1488 pages
72h 53m
English
for(variable in object){ code; }
The for…in object iterates a specified variable over all the properties of an object. The statements, contained in the body, are executed once for each property. The variable is a variable interated over each property in the object. code contains JavaScript statements to be executed.
Listing 6.122 shows how to use the for…in object. The showProperties function takes an object type and object name as arguments. A for…in loop is then executed on the object displaying each of the object's properties and their values.
<html> <body> <script language = "JavaScript> ... |
Read now
Unlock full access