Content-Type: text/plain; charset="UTF-8" Message-ID: <1936201.aqSPkdTlGX@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Tue, 07 Feb 2012 13:15:36 +0100 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 8Bit Subject: Re: help coding a hash table Newsgroups: comp.lang.javascript References: <5cd32919-6fdd-4b39-b452-e138e0949107@lr19g2000pbb.googlegroups.com> <4f310138$0$6915$e4fe514c@news2.news.xs4all.nl> Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 31 NNTP-Posting-Date: 07 Feb 2012 13:15:36 CET NNTP-Posting-Host: 41b6fca1.newsspool4.arcor-online.net X-Trace: DXC=JRDZm8W4\YJN9=nMG On 2/7/2012 2:08 AM, JRough wrote: >> How do I create a javascript associative array […] > > […] > About associative: If you create an empty object, just can add > "properties" with values to it to your heart's liking. That way you have > your associative array behaviour. > > var myTime = new Object(); > myTime.firstName = "J."; > myTime.famName = "Rough"; However, by default there are no empty objects (although there are proprietary ways like assigning to the `__proto__' property to create them, leaving a from then on crippled object). Even Object instances inherit from Object.prototype by default. As a result, some property names (like "toString") are already used. So you should avoid assigning to the corresponding properties in order to store user data. Which points out *again* _that there are no *built-in* associative arrays in ECMAScript implementations_ (but you can try to emulate them, like with jsx.map.Map [1]). PointedEars ___________ [1] -- When all you know is jQuery, every problem looks $(olvable).