May 19, 2006
8:45 am | Last updated: March 7, 2009 at: 5:31 am

Andrew Dupont has an insightful post warning against the use of the javascript Array type for associated arrays, when a simple Object would be better. He says:

In JavaScript, one really ought to use Object for a set of key/value pairs. But because Array works as demonstrated above, JavaScript arrays (which are meant to be numeric) are often used to hold key/value pairs. This is bad practice. Object should be used instead.

Loading

Contextual Related Posts:

1 Response | RSS comments on this post | Leave a comment»

  1. 1
    Mike says#1 | February 15th, 2009 at 12:13 pm

    Thanks for posting this, I found it really helpful!

No Pingback yet

PingBack URI

Leave a Response

Comment Preview
« Marissa Mayer live! Now! Watch!The biggest hacking incident in the web-hosting history UPDATE 11.30 PM GMT »
Feed Icon

Subscribe via RSS or email: