JS Built-ins
FinalizationRegistryregisterbeginner

FinalizationRegistry β€” instanceof check

πŸ“– Usage Example
const reg = new FinalizationRegistry(k => console.log('GC:', k))
let tmp = { id: 1 }
reg.register(tmp, tmp.id)
tmp = null  // allows GC

Set the variable to null to allow the garbage collector to reclaim the object.

FinalizationRegistry instanceof

new FinalizationRegistry(() => {}) instanceof FinalizationRegistry is true.

Challenge: Verify the instanceof check.

πŸ’‘ Hints (1)
  • β€’ instanceof checks the prototype chain.