js hash table example
// Simple ECMA5 hash table
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'; // true
oHash['foo'] === 'bar'; // true
oHash['meow'] = 'another prop'; // true
oHash.hasOwnProperty === undefined; // true
Object.keys(oHash); // ['foo', 'meow']
oHash instanceof Hash; // truevar myHash = new Hash('one',[1,10,5],'two', [2], 'three',[3,30,300]);var myHash = {}; // New object
myHash['one'] = [1,10,5];
myHash['two'] = [2];
myHash['three'] = [3, 30, 300];
Also in JavaScript:
- change background image with jquery
- how to exclude a specefic tagname from a javascript query search
- javascript get current hour
- how to check if input is checked javascript
- enable swipe using javascript
- js array last element
- array.flat
- javascript to uppercase
- console.log
- "socket.removeListener"
- .filter js
- les fonctions reguliere javascript
- nsenter
- angular material spinner with logo
- sequelize create record with foreign key constraint
- check if a variable is undefined jquery
- Selectores de jQuery CSS básicos
- .remove in jquery
- pase de fotos automatico javascript
- show hide more text jquery
- how to check if all inputs are not empty with javascript
- resize js
- javascript alert
- react js materilize