Menu
Going through a javascript tutorial and am stumped on how to make an example work. What is missing from this example?
Example: Using for each…in
The following snippet iterates over an array’s items, calculating their sum:
var sum = 0;
var arr = [5,7,9];
for each (var item in arr) {
sum += item;
}
print(sum);
//Source: [url]http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Statements:for_each…in