-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
40 lines (30 loc) · 956 Bytes
/
test.js
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
29
30
31
32
33
34
35
36
37
38
39
40
import HashMap from "./hashmap.js";
const test = new HashMap();
test.set("apple", "red");
test.set("banana", "yellow");
test.set("carrot", "orange");
test.set("dog", "brown");
test.set("elephant", "gray");
test.set("frog", "green");
test.set("grape", "purple");
test.set("hat", "black");
test.set("ice cream", "white");
test.set("jacket", "blue");
test.set("kite", "pink");
test.set("lion", "golden");
console.log(test.entries());
console.log("---------------------------");
test.remove("dog");
console.log(test.get("dog")); // null
console.log(test.has("dog")); // false
console.log(test.has("kite")); // true
console.log(test.length()); // 11
console.log(test.get("lion")); // golden
test.set("lion", "king of the junjle");
console.log(test.get("lion")); // king of the junjle
test.set("shotgun", "reloading");
test.set("moon", "silver");
console.log(test.values());
console.log(test.length()); // 13
test.set("shotgun", "fire");
test.clear();