DEV Community

Discussion on: Hashmaps: Javascript Edition

Collapse
 
ldbecker profile image
ldbecker

Interesting article. When I think of hash maps I think of them as an array of "buckets", with each bucket being an array of length 2 ([key, value]).

Initializing your hashmap as an empty Javascript object and assigning the keys as properties of that object you are essentially just using the baked in javascript definition of a hash map in your implementation of a hash map. Javascript objects are already hashmaps in their implementation. I hope that makes sense.