WeakSet.prototype.has() vs WeakSet.prototype.delete()
WeakSet.prototype.has() and WeakSet.prototype.delete() are both JavaScript WeakRef APIs, and choosing between them is a common point of confusion. This page compares their syntax, parameters, return values, and typical use cases so you can pick the right one. WeakSet.prototype.has(): Checks for object. Its syntax is ws.has(value). WeakSet.prototype.delete(): Removes an object. Its syntax is ws.delete(value). Example of WeakSet.prototype.has(): ws.has(o). Example of WeakSet.prototype.delete(): ws.delete(o). Read the full references for WeakSet.prototype.has() and WeakSet.prototype.delete() to see edge cases, time complexity, browser support, and the mistakes developers most often make with each. Other WeakRef APIs worth comparing: WeakRef(), WeakRef.prototype.deref(), WeakMap.prototype.has(), WeakMap.prototype.delete(). Both belong to the WeakRef category in the JS Reference documentation, which covers 6 entries in total. Try both in the JavaScript playground to see the behavioral difference live.