WeakMap & WeakSet
Why can't WeakMap and WeakSet be used with primitive values as keys?
Primitives can't be used because: 1) Weak references only make sense for objects that can be garbage collected, 2) Primitive values are not stored by reference in JavaScript, 3) Primitives exist as immutable values rather than garbage-collectable objects, 4) The concept of weak references doesn't apply to value types, 5) This restriction is fundamental to how JavaScript's memory model works, 6) Primitive values are handled differently by the JavaScript engine's memory management, 7) This limitation ensures WeakMap and WeakSet maintain their memory management benefits, 8) Understanding this helps in choosing appropriate use cases for these collections.