This may come in handy too:

http://www.prototypejs.org/api/hash

var foo = $H({
  name: "value",
  foo: "bar"
});

Then instead of iterating with for(var x in foo) you could use:

foo.each(function(pair) {
  alert(pair.key + ' = "' + pair.value + '"');
});

- Ryan Schuft


On Apr 26, 6:55 pm, Michael Peters <[EMAIL PROTECTED]> wrote:
> Andrew Dupont wrote:
> >http://www.andrewdupont.net/2006/05/18/javascript-associative-arrays-...
>
> Just to clarify, it all depends on what you mean by "associative array". To me
> that means Hash, but that's cause I come from Perland.
>
> Since you didn't show us how you declared your associative array, I'm assuming
> you meant something like this:
>
>   var myAssocArry = new Array();
>
> But if you instead used a Javascript Object (which is more like a Perl hash)
> then you most certainly can use for( var j in ...);
>
>   var myAssocArry = {}
> or
>   var myAssocArry = new Object();
>
> --
> Michael Peters
> Developer
> Plus Three, LP


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to