function MyMap() { var items = {}; this.has = function (key) { return key in items; }; this.set = function (key, value) { items[key] = value; }; this.remove = function (key) { if (this.has(key)) { delete items[key]; return true; } return false; }; this.get = function (key) { return this.has(key) ? items[key] : undefined; }; this.values = function () { var values = new Array(); for (var k in items) { if (this.has(k)) { values.push(items[k]); } } return values; }; this.getItems = function () { return items; }; this.clear = function () { items = {}; }; this.getCount = function () { return Object.keys(items).length; }; }