how to create a hash table in 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 = new Hash('one',[1,10,5],'two', [2], 'three',[3,30,300]);
Example 3: js hash table example
var myHash = {};
myHash['one'] = [1,10,5];
myHash['two'] = [2];
myHash['three'] = [3, 30, 300];