Michael said:
It's not strictly a hash table. What you have above is an object literal
that contains a property/value list. The following snippets are
equivalent:
Thanks for pointing out that. When I quickly searched for hash array
implementation in JS, I came across that. Didn't know that it's object
and properties.
var hash = {a : '1', b : '2'};
var hash = {}; // or new Object();
hash.a = '1';
hash.b = '2';
Why would you want to? There's no benefit. But to answer your question,
you'll have to add the properties one by one:
Yes, it doesn't work--both Array and ordinary objects work same in
hash thing. I'd thought in Array, we can use reverse() method and
length property as I need to reverse the hash array--but to my
surprise, it doesn't work--even though Array has reverse() method.
Basically, I want to translate certain characters and implementing
something like PHP's strtr <
http://in.php.net/strtr>. In one occasion,
I need to translate characters using map table in forward order, but in
other case need to do in reverse order. I'd thought that hash
implementation would be better in this case as it provides better
readability, etc. In JS, forward thing works fine, but couldn't reverse
such hash array. Any idea?
[snip]
Signature separators are two dashes followed by a space. You seem to have
omitted the space.
It's not me, but stupid GG Beta; I'm tired of reporting bugs as they
don't care about anything. Sounds like they're saving bits and bytes to
offer GB for their Gmail