Iterates a specified variable over all the properties of an object. For each distinct property, MetaScript executes the specified statements.
Syntax
for ( variable in object )
{
statements
}
Parameters
Parameter | Description |
---|---|
variable | Variable to iterate over every property, declared with the var keyword. This variable is local to the function, not to the loop. |
object | Object for which the properties are iterated. |
statements | Specifies the statements to execute for each property. |
Examples
The following function takes as its argument an object and the object's name. It then iterates over all the object's properties and returns a string that lists the property names and their values.