quote:
Originally posted by Spunky
js code:
for (var s in test){
Debug.Trace(test[s]);
}
EDIT: foreach is used in PHP
And several other languages, it's just not called foreach.
[Java has for(Item : Collection), etc.]
Jscript code:
for (var enumerator = new Enumerator(myCollection) ; !enumerator.atEnd(); enumerator.moveNext()) {
// code
}
quote:
for...in is also a solution, but more used for Objects.
This does
not work in JScript. In JScript for ... in is used to enumerate the *properties* of an object, whereas in VBScript it is used to enumerate members of a collection.
Ref