DEV Community

Discussion on: Recap of Data Structures with Javascript Part 1

Collapse
 
nicolasmesa profile image
Nicolas Mesa

Really cool! Thanks for sharing.

I think there's a bug in the setter of the HashTable:

if(isKeyExists){
    //key already exists, overwrite the previous value

    // here, you're overriding the whole array. If there were any collisions, all of them would be deleted.
    this.storage[index] = [[key, value]] 
}else{
    ...
}