JS Built-ins
WeakRefderefbeginner

WeakRef.deref β€” is a function

πŸ“– Usage Example
const ref = new WeakRef({ id: 1 })
ref.deref() !== undefined  // β†’ true (still alive)

If deref() returns a value, the object is still alive at that moment.

WeakRef prototype.deref

typeof WeakRef.prototype.deref is 'function'.

Challenge: Verify that deref is on the prototype.

πŸ’‘ Hints (1)
  • β€’ Methods on built-in constructors live on the prototype.