メインコンテンツまでスキップ

· 約17分
Zhenghao He

See discussions on Reddit

In JavaScript, objects are handy. They allow us to easily group multiple pieces of data together. After ES6, we got a new addition to the language - Map. In a lot of aspects, it seems like a more capable Object with a somewhat clumsy interface. However, most people still reach for objects when they need a hash map and only switch to using Map when they realize the keys can't just be strings for their use cases. As a result, Map remains underused in today's JavaScript community.

In this post, I will break down all the reasons when you should consider using Map more and its performance characteristics with benchmarks.