hash table em javascript code example
Example 1: js hash table example
Hash = function(oSource){
for(sKey in oSource) if(Object.prototype.hasOwnProperty.call(oSource, sKey)) this[sKey] = oSource[sKey];
};
Hash.prototype = Object.create(null);
var oHash = new Hash({foo: 'bar'});
oHash.foo === 'bar';
oHash['foo'] === 'bar';
oHash['meow'] = 'another prop';
oHash.hasOwnProperty === undefined;
Object.keys(oHash);
oHash instanceof Hash;
Example 2: js hash table example
var myHash = {};
myHash['one'] = [1,10,5];
myHash['two'] = [2];
myHash['three'] = [3, 30, 300];