On Mar 28, 8:44 am, 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...).
>
> When I include my new module with Prototype to my existing app, all
> the for..in statements for the Array are getting the functions from
> the prototype.js as elements in it. Is there something I need to do to
> avoid this?

You can test each property with hasOwnProperty:

  for (var p in obj) {
    if (obj.hasOwnProperty(p)) {
      // p is a propery of obj, not its prototype chain
    }
  }

--
Rob

--~--~---------~--~----~------------~-------~--~----~
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