Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardJavaScriptWeakRef and FinalizationRegistrySingle-choice MCQ

The spec says a WeakRef's deref() must not return undefined and then later (within the same job / synchronous run) return a non-undefined value. What invariant is this protecting?

const wr = new WeakRef({ id: 1 }); function job() { const a = wr.deref(); // ... a lot of code, no awaits ... const b = wr.deref(); return [a, b]; }