WeakMap
A WeakMap
object maps references from object keys (i.e. non-primitives) to other values. The important distinction between a WeakMap
and an ordinary object ({}
) is that the keys in a WeakMap can be objects, while an ordinary object only allows string
values as keys.