Yes, you're right, of course. I'm going to use Szymon's method.

It just seems that it's a bit of a song-and-dance to do something that
you'd assume would be handled in the native functionality of
JavaScript arrays.

On Apr 2, 11:30 am, Walter Lee Davis <wa...@wdstudio.com> wrote:
> What's missing is associative arrays in JavaScript. As to adding  
> elements in a (Prototype) Hash, Szymon already gave you that:
>
> ax.set('aad',4);
>
> And there's a matching get() function to pluck an individual element  
> out of the Hash, too.
>
> ax.get('aad') //--> 4
>
> Walter
>
> On Apr 2, 2009, at 11:04 AM, Diodeus wrote:
>
> > The problem is in my case, I'm adding elements to the array as I go,
> > as opposed to building it as a JSON-type hash up front.
>
> > I'd like to be able to do:
>
> > ax[newValue] = y
>
> > Looping through an associative array should be simple, but I'm missing
> > something here.
--~--~---------~--~----~------------~-------~--~----~
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-scriptaculous@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