Jump to content

Don't use for(var x in y)


Guest Nils

Recommended Posts

Posted

It would be great if you could remove all for(... in ...) loops from your javascript files and replace them by normal for(i=...;...;i++) loops. I know they work fine usually, but when you are using a library that extends the Object object (for example prototype), the loop returns several methods in addition to the array's items, which breaks several functions.

Posted

Some of the for (var x in y) commands are necessary because not all y varaibles are arrays, they are objects, thus you can't do a simple for (var x=0; x<y.length; x++) command.

Posted

We updated a lot of these in 2.3, because I implemented lightbox in Gallery (which uses prototype). Mainly in the menu generation javascript libraries.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...