Creating a WeakMap from existing data  

We just saw how to add values individually to a WeakMap and why it is different from a Map. However, it can be tedious to create a WeakMap one entry at a time.

In this recipe, we'll take a look at how to create a new Map with the preexisting data.

Get ECMAScript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.