JS Built-ins
WeakRefderefbeginner

WeakRef.deref β€” typeof result

πŸ“– Usage Example
const ref = new WeakRef({})
const obj = ref.deref()
if (obj) { /* safe to use */ }

Check the result of deref() before using it to avoid null-reference errors.

WeakRef deref typeof

typeof new WeakRef({}).deref() is 'object'.

Challenge: Verify the type of the deref result.

πŸ’‘ Hints (1)
  • β€’ deref() returns the referenced object which has typeof "object".