1function hashFnv32a(str, asString, seed) {
2 /*jshint bitwise:false */
3 var i, l,
4 hval = (seed === undefined) ? 0x811c9dc5 : seed;
5
6 for (i = 0, l = str.length; i < l; i++) {
7 hval ^= str.charCodeAt(i);
8 hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24);
9 }
10 if( asString ){
11 // Convert to 8 digit hex string
12 return ("0000000" + (hval >>> 0).toString(16)).substr(-8);
13 }
14 return hval >>> 0;
15}
1var h = new Object(); // or just {}
2h['one'] = 1;
3h['two'] = 2;
4h['three'] = 3;
5
6// show the values stored
7for (var k in h) {
8 // use hasOwnProperty to filter out keys from the Object.prototype
9 if (h.hasOwnProperty(k)) {
10 alert('key is: ' + k + ', value is: ' + h[k]);
11 }
12}
13