On Thu, Mar 27, 2008 at 4:44 PM, Muthu <[EMAIL PROTECTED]> wrote:
>
>  I have a small module that I am developing using Prototype. I have
>  javascript Array's declared in my existing app and the we access the
>  elements using for...in - for(x in myArray...).

Like Ryan said, don't use for ... in.

In prototype, you can loop over the items in an array like so:

my_array_variable.each(function(element) {
  // do cool stuff with the element here
});

And that's just the tip of the iceberg of stuff you can do with arrays
and other enumerable data types in Prototype. Check out the API docs
for stuff like map() and invoke().

:Dan

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to