JS Built-ins
FinalizationRegistryregisterbeginner

FinalizationRegistry β€” unregister on prototype

πŸ“– Usage Example
const reg = new FinalizationRegistry(k => {})
let o = {}
reg.register(o, 'data')
// reg holds a weak reference; o can still be GC-ed

FinalizationRegistry holds only a weak reference, so it does not prevent garbage collection.

unregister on Prototype

typeof FinalizationRegistry.prototype.unregister is 'function'.

Challenge: Verify unregister exists on the prototype.

πŸ’‘ Hints (1)
  • β€’ Both register and unregister are defined on FinalizationRegistry.prototype.