DEV Community

Discussion on: WeakMap in JavaScript - An Easy Introduction

Collapse
 
aminmansuri profile image
hidden_dude

Can you clarify your use cases? I didn't understand what you meant by wanting to add some additional values to objects.

I've know about WeakArrays and WeakMaps in other languages for a long time. But the only scenario where I found them maybe useful was for listeners/observers. When you register a listener on your object maybe you don't want to prevent that object from being garbage collected.

But I came to this article hoping for more examples of usefulness.