Click to See Complete Forum and Search --> : Javascript Hashes. Confusion.


labheshr
August 12th, 2008, 08:11 PM
Hello Everyone!

I am new to JS and esp to Object Oriented Javascript. I am having to deal with some complicated JS code that involves extensive use of hashes. The idea is that the data is being accessed from some Database and stored in these hashes. Although I know that a hash is essentially a key-value pair. I am confused with the following declaration and usage of hashes.

1. temp = aHash["A"][ some[i] ];
returnData[temp];

2. var b = hash[key]["B"];

3. cHash = d[ some[i] ];
if(cHash["A"])
{
doSomething....
}

Can someone please explain me above syntaxes with examples? Any help will be greatly appreciated.

PeejAvery
August 13th, 2008, 06:46 AM
[ moved ]

PeejAvery
August 13th, 2008, 06:57 AM
In JavaScript, the term hash is almost never used anymore. They are better known as associative arrays. If you understand a numerical indexed array, then you already understand an associative. Instead of using integers as the key, it uses a string. Then, you can also build as many dimensions as you like.