Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
To work seamlessly with standard ECMAScript, E4X makes some changes to the base language. One change is the introduction of the for-each-in loop. As opposed to the for-in loop, which iterates over each property and returns the property name, the for-each-in loop iterates over each property and returns the value of the property, as this example illustrates:
var employees = <employees>
<employee position="Software Engineer">
<name>Nicholas C. Zakas</name>
</employee>
<employee position="Salesperson">
<name>Jim Smith</name>
</employee>
</employees>;
for each (var child in employees){
alert(child.toXMLString());
}