Skip to content

Commit fd6ba01

Browse files
committed
Dictionary & Hash Data done
1 parent 9fab463 commit fd6ba01

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

dictionary.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Dictionary And Hash Table
2+
3+
class Dictionary {
4+
constructor() {
5+
this.dictionary = {};
6+
}
7+
add(key , value){
8+
this.dictionary[key] = value;
9+
}
10+
get(key){
11+
return this.dictionary[key];
12+
}
13+
}
14+
15+
const phoneBook = new Dictionary();
16+
17+
phoneBook.add("saidul", "01755555555")
18+
phoneBook.add("Shakil", "01888888555")
19+
phoneBook.add("Aminul", "01999999999")
20+
21+
// console.log(phoneBook.dictionary);
22+
23+
const aminul = phoneBook.get("Aminul");
24+
25+
// console.log(aminul);

0 commit comments

Comments
 (0)