WoodMan 潛水喵 says to OwO
/js@mmis_js_bot function Dictonary(){ var items = {}; this.has = function(key){ return key in items; }; this.set = function(key, value){ items[key] = value; }; this.size = function(key, value){ items[key] = value; return value; }; this.get = function(key){ return this.has(key) ? items[key] : undefined; }; this.values = function(){ var values = {}; for (var k in items){ if (this.has(k)){ values.push(items[k]); } } }; this.getItems = function(){ return items; }; this.keys = function() { return Object.keys(items); }; this.size = function() { var count = 0; for(var prop in items) { if(items.hasOwnProperty(prop)) { ++count; } return count; } }; } var test = new Dictionary(); test.set('test, 'ouo'); console.log(test.size()); console.log(test.keys());