javascript lookup-hash implemented as object

Javascript syntax is rich and confusing. Better get the underlying idea before you try to memorize the syntax.

There's no builtin construct to get the length of an associative array, since it's an object.

Everything in javascript is an object. Everything. Arrays, functions, even numbers! Because of this, you can do some really interesting things, such as modifying the prototypes of Objects, Arrays, etc

Javascript arrays are a type of object used for storing multiple values in a single variable. Each value gets numeric index and may be any data type. OReilly's javascript book:

JavaScript objects are much more like Perl hashes than C++ or Java objects.

In JavaScript, objects are also associative arrays (or hashes). That is, the property


can also be read or written by calling


Thus, you can access each property by entering the name of the property as a string into this array. Such an array associates each key with a value (in this case the key Home is associated with the value normal). In the Perl programming language it is also called a hash.

Unlike **Perl**, which requires you to create such an associative array explicitly, JavaScript automatically creates a associative array for each object.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s