Title: WeakMap - JavaScript | MDN
Open Graph Title: WeakMap - JavaScript | MDN
Description: A WeakMap is a collection of key/value pairs whose keys must be objects or non-registered symbols, with values of any arbitrary JavaScript type, and which does not create strong references to its keys. That is, an object's presence as a key in a WeakMap does not prevent the object from being garbage collected. Once an object used as a key has been collected, its corresponding values in any WeakMap become candidates for garbage collection as well — as long as they aren't strongly referred to elsewhere. The only primitive type that can be used as a WeakMap key is symbol — more specifically, non-registered symbols — because non-registered symbols are guaranteed to be unique and cannot be re-created.
Open Graph Description: A WeakMap is a collection of key/value pairs whose keys must be objects or non-registered symbols, with values of any arbitrary JavaScript type, and which does not create strong references to its keys. That is, an object's presence as a key in a WeakMap does not prevent the object from being garbage collected. Once an object used as a key has been collected, its corresponding values in any WeakMap become candidates for garbage collection as well — as long as they aren't strongly referred to elsewhere. The only primitive type that can be used as a WeakMap key is symbol — more specifically, non-registered symbols — because non-registered symbols are guaranteed to be unique and cannot be re-created.
Opengraph URL: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap
Domain: developer.mozilla.org
| og:locale | en_US |
| og:image | https://developer.mozilla.org/mdn-social-image.46ac2375.png |
| og:image:type | image/png |
| og:image:height | 1024 |
| og:image:width | 1024 |
| og:image:alt | The MDN logo |
| og:site_name | MDN Web Docs |
| twitter:card | summary |
| twitter:creator | MozDevNet |
| position | 5 |
Links:
Viewport: width=device-width, initial-scale=1.0