On Aug 3, 2:19 am, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
> Hi,
>
> > > Yes, it's an extremely common misconception.
>
> > What, that for..in iterates over an object's properties?
>
> No, that it loops over array indexes.

I'm missing something here. Array indexes are properties, which is why
they are included in for..in iteration. The OPs problem was how to
deal with properties from the [[prototype]] chain, not that array
properties were included in for..in.

There are two issues to deal with when using for..in with a javascript
array:

 1. properties may have been added to Array.prototype, and

 2. object properties are not guaranteed to be returned in any
particular order

Both the above are common to any use of for..in. Item 1 is easily
dealt with. If order matters, a for, while or do loop can be used.
Otherwise, there is no issue.


--
Rob

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to