JS Built-ins
WeakSetdeletebeginner

WeakSet.prototype.delete() β€” returns true

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

delete() removes the object from the WeakSet and returns true if it was present.

WeakSet delete()

ws.delete(obj) returns true when the object was in the set.

Challenge: Verify delete returns true.

πŸ’‘ Hints (1)
  • β€’ delete() returns true when the object existed in the set.