Maps and WeakMaps with ES6

Share this video with your friends

Send Tweet

A brief introduction to Maps and WeakMaps with ES6, the usage of and difference of Maps and WeakMaps.

Ron
Ron
~ 5 years ago

I'm not seeing much value in Map, since I can do an Object.keys(obj) or Object.entries(obj), etc.

Marcell Ciszek
Marcell Ciszek
~ 5 years ago

When should you use a week Map?

Lauro Silva
Lauro Silva
~ 5 years ago

One difference to Map objects is that WeakMap keys are not enumerable. If they were, the list would depend on the state of garbage collection, introducing non-determinism. One use case of WeakMap objects is to store private data for an object, or to hide implementation details.

Marcell Ciszek
Marcell Ciszek
~ 5 years ago

Thank Lauro , a really good explanation. Thank you