aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/conflicting/web/javascript/reference/global_objects/weakset/index.html
blob: d06fca34dc552a405c20897b940002aed589c355 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
---
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
---
<div>{{JSRef("Global_Objects", "WeakSet")}}</div>

<h2 id="Summary" name="Summary">Summary</h2>

<p>The <code><strong>WeakSet</strong></code><strong><code>.prototype</code></strong> property represents the prototype for the {{jsxref("WeakSet")}} constructor.</p>

<div>{{js_property_attributes(0,0,0)}}</div>

<h2 id="Description" name="Description">Description</h2>

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

<h2 id="Properties">Properties</h2>

<dl>
 <dt><code>WeakSet.prototype.constructor</code></dt>
 <dd>返回构造函数即 {{jsxref("WeakSet")}} 本身.</dd>
</dl>

<h2 id="Methods">Methods</h2>

<dl>
 <dt>{{jsxref("WeakSet.add", "WeakSet.prototype.add(value)")}}</dt>
 <dd> 在<span style="line-height: 1.5;">该 </span><code style="font-size: 14px;">WeakSet</code><span style="line-height: 1.5;"> 对象中添加一个新元素 <code>value</code>.</span></dd>
 <dt>{{jsxref("WeakSet.delete", "WeakSet.prototype.delete(value)")}}</dt>
 <dd><span style="line-height: 1.5;">该 </span><code style="font-size: 14px;">WeakSet</code><span style="line-height: 1.5;"> 对象中删除</span><span style="line-height: 1.5;"> </span><code style="font-size: 14px;">value </code><span style="line-height: 1.5;">这个元素, 之后 </span><code style="font-size: 14px;">WeakSet.prototype.has(value)</code><span style="line-height: 1.5;"> 方法便会返回 </span><code style="font-size: 14px;">false</code><span style="line-height: 1.5;">.</span></dd>
 <dt>{{jsxref("WeakSet.has", "WeakSet.prototype.has(value)")}}</dt>
 <dd>返回一个布尔值,  表示给定的值 <code>value</code> 是否存在于这个 <code>WeakSet</code> 中.</dd>
</dl>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('ES6', '#sec-weakset.prototype', 'WeakSet.prototype')}}</td>
   <td>{{Spec2('ES6')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{ CompatibilityTable() }}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatNo() }} {{bug(792439)}}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatNo() }}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatNo() }} {{bug(792439)}}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatNo() }}</td>
  </tr>
 </tbody>
</table>
</div>

<h3 id="Chrome-specific_notes">Chrome-specific notes</h3>

<ul>
 <li>This feature is available behind a preference. In <code style="font-size: 14px;">chrome://flags</code>, activate the entry “Enable Experimental JavaScript”.</li>
</ul>

<h2 id="See_also">See also</h2>

<ul>
 <li>{{jsxref("Set.prototype")}}</li>
 <li>{{jsxref("WeakMap.prototype")}}</li>
</ul>