for (posArray = [], i = 0; i < this.length; posArray[i] = i++) {}

It's just "shorthand". The first part, seperated by a comma, is just a declaration within the scope of the loop. So posArray and i are declared and a value assigned to them. The second part is a simple conditional: i<this.length. When i is >= this.length, the loop will end. The last part just assigns the value of i to the array and then increments it, in that order. If it said posArray[i] = ++i instead, it would increment i before assigning the value to the array.

All that's really different about that loop is an extra declaration in the declaration parameter and an assignment in the increment parameter. It's valid syntax for most implementations of ECMAScript, and would work in JavaScript too.

What confused me was the use of "this.length", until I realized it was a prototype for the Array object, and this.length would be the length property of the array.

ryanm
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to