Skip to content

Instantly share code, notes, and snippets.

@restorer
Created April 15, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save restorer/7a9d693e0f3ecd29ffea to your computer and use it in GitHub Desktop.
Save restorer/7a9d693e0f3ecd29ffea to your computer and use it in GitHub Desktop.
HashMap for javascript target
// http://kangax.github.io/compat-table/es5/#Object.create
var HashMap = function() {}
HashMap.prototype = Object.create(null);
var map = new HashMap();
map.__proto__ = '__proto__ value';
map.hasOwnProperty = 'hasOwnProperty value';
map.prototype = 'prototype value';
map.toString = 'toString value';
for (var key in map) {
console.log('key=[' + key + '] value=[' + map[key] + ']');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment