educative.io

Educative

There is a bug in Hash Table implementation

follow your code:
let table = new HashTable(); //Create a HashTable console.log(table.isEmpty()); table.insert("This", 1); table.insert("is", 2)


insert(key, value) { //Find the node with the given key let b_Index = this.getIndex(key);

getIndex(key) { let index = key % this.slots;

so, you do modulo operation with string - it is really interesting )))