Sam Collett schrieb: > On 03/01/07, Klaus Hartl <[EMAIL PROTECTED]> wrote: >> Birgit Pauli-Haack schrieb: >>> I have some data in an js associative array: >>> >>> texts = new Array; >>> texts.webmail = "Go directly to Web e-mail. The easy way to read and >>> write e-mail when you are away from home."; >>> texts.dsl ="Complete information on the DSL service."; >>> texts.members = "Member information and downloads." >> You say you have an associative array so you should use one. Abusing an >> array (list) for that is considered bad practice. >> >> var texts = {}; // short for new Object(); >> >> ... >> >> >> >> -- Klaus > > I think there are probably quite a few that do that (use Array instead > of Object). Also, there is no true associative array functionality in > JavaScript as 'texts.length' will always return 0 if you use > 'texts['foo'] = bar' > > What exacerbates this issue is that the first search on Google for > 'associative array javascript' suggests this use.
For anyone who's interested: http://www.andrewdupont.net/2006/05/18/javascript-associative-arrays-considered-harmful/ http://erik.eae.net/archives/2005/06/06/22.13.54/ -- Klaus _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/