We've seen how to use Maps in a variety of situations. There is another new class in ECMAScript that behaves in a very similar way, but has some helpful properties. The WeakMap, like Map, is a key-value data structure.
In this recipe, we'll take a look at how to add and remove elements from a WeakMap with the set and delete methods. And we'll also see how they differ from the Map class.