It's got nothing to do with luck. Arrays are implemented as a very
light veneer on top of Objects; the only real difference between them
is the literal syntax ([]) and the magic "length" property that counts
your numeric keys. (In fact, the numeric keys aren't really numbers,
since all object properties are coerced into strings.)

Considering that the Selector class uses Template strings with arrays,
I wouldn't call it improper, either. We can argue about whether it's
"hacky" or not, but it's a behavior that deserves to be documented.
Thanks for bringing this up, Jon; I'll put this on our documentation
to-do list.


On Jun 24, 9:36 pm, jdalton <[EMAIL PROTECTED]> wrote:
> I find using the object is easier to read, also looking at the source
> its really meant for objects to be used, you got lucky in that
> object['days'] is also the same syntax used by array[0]. That is why
> indexes would work for your array and not for the object and why the
> property 'days' would work for the object and not the array.
> I don't think the documentation should support improper usage. I would
> classify using an array instead of an object as hacky implementation.

You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at

Reply via email to