Iterating over sparse arrays @ Ash Searle’s Blog

This is a quick tip for iterating over arrays and other objects with a length property. It’s particularly suitable for sparse arrays, without having to worry whether any methods have been added to the prototype chain.

Iterating over sparse arrays @ Ash Searle’s Blog

Users of the Prototype library who are also rolling their own code can use this, as Prototype does some modifications to Array’s prototype that breaks traditional for … in behavior.

Tags: , , ,

Comments are closed.

I'm Reading…
Search This Site

AddThis Feed Button

Need great hosting?

Categories