JS Built-ins
WeakRefbeginner

WeakRef β€” deref returns original object

πŸ“– Usage Example
const ref = new WeakRef({})
ref instanceof WeakRef  // β†’ true

WeakRef instances can be checked with instanceof.

WeakRef deref

new WeakRef(obj).deref() === obj is true.

Challenge: Verify that deref returns the original object.

πŸ’‘ Hints (1)
  • β€’ deref() returns the referenced object if it has not been garbage collected.