JS Built-ins
WeakSethasbeginner

WeakSet.prototype.has() β€” constructor-initialized

πŸ“– Usage Example
const ws = new WeakSet()
const o = {}
ws.add(o)
ws.has(o)  // β†’ true

Use has() to guard operations that should only run once per object.

WeakSet has() After Constructor Init

Objects passed to the constructor are present immediately.

Challenge: Verify has() for constructor-initialized objects.

πŸ’‘ Hints (1)
  • β€’ Objects passed to the WeakSet constructor are immediately present.