1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class Dictionary {
constructor() {
this.store = new Object();
}
add(key, val) {
this.store[key] = val;
}
del(key) {
delete this.store[key];
}
find(key) {
return this.store[key];
}
has(key) {
return this.store[key] === undefined ? false : true;
}
size() {
return Object.keys(this.store).length;
}
toString() {
const keys = Object.keys(this.store);
keys.forEach((key) => {
console.log(`key:${key}:${this.store[key]}`);
});
}
}

module.exports = Dictionary;