hash table how to get the value of a specific key javascript code example
Example 1: js hash table example
var myHash = new Hash('one',[1,10,5],'two', [2], 'three',[3,30,300]);
Example 2: 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;