contents   index   previous   next



for/in

 

The for/in statement is a way to loop through all of the properties of an object, even if the names of the properties are unknown. The statement has the following form.

 

for (var property in object)

{

   DoSomething(object[property]);

}

 

where object is the name of an object previously defined in a script. When using the for . . . in statement in this way, the statement block will execute once for every property of the object. For each iteration of the loop, the variable property contains the name of one of the properties of object and may be accessed with "object[property]". Note that properties that have been marked with the DontEnum attribute are not accessible to a for . . . in statement.

 

SElib.getObjectProperties() is similar to the ECMAScript for/in loop. The important difference is that a for/in loop does not enumerate properties that have DONT_ENUM as part of their attributes (global.setAttributes()), whereas SElib.getObjectProperties() includes them in the array that it returns. See Object propertyIsEnumerable().

 


with