forked from SF-WDI-LABS/hash-map-lab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdriver.js
30 lines (21 loc) · 1.02 KB
/
driver.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
var HashMap = require('./hash-map.js');
/* Initialize a hashMap of array length 13. 13 is prime. 13 is magic. */
var hMap = new HashMap(13);
// var paragraph = "Hi everyone this is justin how are you i am fine thank you for asking that is so very sweet of you so i am an instructor at general assembly in san francsico california which is actually a republic i don't know if you knew that but it is true"
//
// /* Rip the above paragraph into an array and feed each word into the hashMap. */
// paragraph.split(' ').forEach(function add(word) { hMap.put(word, word.split('').reverse().join('')); });
hMap.put('fruit', 'apple');
/* Demonstrate the get() method */
var found = hMap.get('fruit');
console.log('Found:', found);
/* TODO: Implement the `set` method! */
// hMap.set('fruit', 'banana');
/* Demonstrate the remove() method */
var deleted = hMap.remove('fruit');
console.log('Deleted;', deleted);
/* Print the hashMap in it's connected entirity */
//hMap.print();
/* Print a list */
//keys = hMap.keySet();
//console.log(keys);