Google search bar

December 12, 2007

Prototype extends arrays so they should not be used as hash sets

We've started using the Prototype js library. We were having some weird behavior with some arrays in existing code when the Prototype lib was included in a page.

Turns out that Prototype adds some methods to Array. They are good, but one should be careful using Array objects as hash(key-value) sets.

Here is the blog entry we found that cleared everything up.

The skinny, Use Object as a hash, nothing else.

Thanks for the insight, Andrew Dupont.

No comments: