diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
commit | 074785cea106179cb3305637055ab0a009ca74f2 (patch) | |
tree | e6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/ru/web/javascript/reference/global_objects/weakset/add | |
parent | da78a9e329e272dedb2400b79a3bdeebff387d47 (diff) | |
download | translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2 translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip |
initial commit
Diffstat (limited to 'files/ru/web/javascript/reference/global_objects/weakset/add')
-rw-r--r-- | files/ru/web/javascript/reference/global_objects/weakset/add/index.html | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/files/ru/web/javascript/reference/global_objects/weakset/add/index.html b/files/ru/web/javascript/reference/global_objects/weakset/add/index.html new file mode 100644 index 0000000000..3534fb4d59 --- /dev/null +++ b/files/ru/web/javascript/reference/global_objects/weakset/add/index.html @@ -0,0 +1,77 @@ +--- +title: WeakSet.prototype.add() +slug: Web/JavaScript/Reference/Global_Objects/WeakSet/add +tags: + - ECMAScript6 + - JavaScript + - Method + - Prototype + - WeakSet +translation_of: Web/JavaScript/Reference/Global_Objects/WeakSet/add +--- +<div>{{JSRef("Global_Objects", "WeakSet")}}</div> + +<p>Метод <code><strong>add()</strong></code> добавляет новый объект в конец объекта WeakSet.</p> + +<h2 id="Syntax" name="Syntax">Синтаксис</h2> + +<pre class="syntaxbox"><code><em>ws</em>.add(value);</code> +</pre> + +<h3 id="Parameters" name="Parameters">Параметры</h3> + +<dl> + <dt>value</dt> + <dd>Обязателен. Объект, добавляемый в WeakSet.</dd> +</dl> + +<h2 id="Examples" name="Examples">Примеры</h2> + +<h3 id="Example:Using_the_add_method" name="Example:Using_the_add_method">Использование метода add</h3> + +<pre class="brush: js">var ws = new WeakSet(); + +ws.add(window); // добавляет объект window в WeakSet + +ws.has(window); // true + +// Weakset принимает в качестве параметров только объекты +ws.add(1); +// результат в Chrome: "TypeError: Invalid value used in weak set" +// результат в Firefox: "TypeError: 1 is not a non-null object" </pre> + +<h2 id="Specifications" name="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.add', 'WeakSet.prototype.add')}}</td> + <td>{{Spec2('ES6')}}</td> + <td>Изначальное определение.</td> + </tr> + <tr> + <td>{{SpecName('ESDraft', '#sec-weakset.prototype.add', 'WeakSet.prototype.add')}}</td> + <td>{{Spec2('ESDraft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">Совместимость с браузерами</h2> + +<p>{{Compat("javascript.builtins.WeakSet.add")}}</p> + +<div id="compat-mobile"> </div> + +<h2 id="See_also" name="See_also">Смотрите также</h2> + +<ul> + <li>{{jsxref("WeakSet")}}</li> + <li>{{jsxref("WeakSet.prototype.delete()")}}</li> + <li>{{jsxref("WeakSet.prototype.has()")}}</li> +</ul> |