Standard built-ins
WeakSet.prototype.add()
Add an eligible weak member; reject ineligible primitives.
Formal Syntax & Structure
javascript syntaxjavascript
weakSet.add(value)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| value | Object | nonregistered Symbol | Eligible weak member. |
Return Value
WeakSet
Same set.
Working Example
Example Snippetjavascript
const k={};const s=new WeakSet();console.log(s.add(k)===s);