JS Built-ins
WeakRefbeginner

WeakRef β€” instanceof

πŸ“– Usage Example
let obj = { data: 42 }
const ref = new WeakRef(obj)
ref.deref().data  // β†’ 42

WeakRef holds a weak reference to an object that does not prevent garbage collection.

WeakRef Constructor

new WeakRef(obj) instanceof WeakRef is true.

Challenge: Verify the instanceof check.

πŸ’‘ Hints (1)
  • β€’ WeakRef is a constructor that creates a weak reference to an object.