--- title: WeakSet.prototype slug: conflicting/Web/JavaScript/Reference/Global_Objects/WeakSet translation_of: Web/JavaScript/Reference/Global_Objects/WeakSet translation_of_original: Web/JavaScript/Reference/Global_Objects/WeakSet/prototype original_slug: Web/JavaScript/Reference/Global_Objects/WeakSet/prototype ---
{{JSRef("Global_Objects", "WeakSet")}}

Summary

The WeakSet.prototype property represents the prototype for the {{jsxref("WeakSet")}} constructor.

{{js_property_attributes(0,0,0)}}

Description

{{jsxref("WeakSet")}} instances inherit from {{jsxref("WeakSet.prototype")}}. You can use the constructor's prototype object to add properties or methods to all WeakSet instances.

Properties

WeakSet.prototype.constructor
返回构造函数即 {{jsxref("WeakSet")}} 本身.

Methods

{{jsxref("WeakSet.add", "WeakSet.prototype.add(value)")}}
 在该 WeakSet 对象中添加一个新元素 value.
{{jsxref("WeakSet.delete", "WeakSet.prototype.delete(value)")}}
该 WeakSet 对象中删除 value 这个元素, 之后 WeakSet.prototype.has(value) 方法便会返回 false.
{{jsxref("WeakSet.has", "WeakSet.prototype.has(value)")}}
返回一个布尔值,  表示给定的值 value 是否存在于这个 WeakSet 中.

Specifications

Specification Status Comment
{{SpecName('ES6', '#sec-weakset.prototype', 'WeakSet.prototype')}} {{Spec2('ES6')}} Initial definition.

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{ CompatVersionUnknown() }} {{ CompatNo() }} {{bug(792439)}} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{ CompatNo() }} {{ CompatNo() }} {{bug(792439)}} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }}

Chrome-specific notes

See also