Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #11434

Re: help coding a hash table

Message-ID <1936201.aqSPkdTlGX@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2012-02-07 13:15 +0100
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

Followups directed to: comp.lang.javascript

Show all headers | View raw


Erwin Moller wrote:

> 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] <http://PointedEars.de/scripts/map.js>
-- 
When all you know is jQuery, every problem looks $(olvable).

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

help coding a hash table JRough <janis.rough@gmail.com> - 2012-02-06 17:08 -0800
  Re: help coding a hash table Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-02-07 11:47 +0100
    Re: help coding a hash table Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-07 13:15 +0100

csiph-web