diff options
Diffstat (limited to 'files/ca/conflicting/web/javascript/reference/global_objects/set/index.html')
-rw-r--r-- | files/ca/conflicting/web/javascript/reference/global_objects/set/index.html | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/files/ca/conflicting/web/javascript/reference/global_objects/set/index.html b/files/ca/conflicting/web/javascript/reference/global_objects/set/index.html new file mode 100644 index 0000000000..9d6f6e90ee --- /dev/null +++ b/files/ca/conflicting/web/javascript/reference/global_objects/set/index.html @@ -0,0 +1,124 @@ +--- +title: Set.prototype +slug: Web/JavaScript/Referencia/Objectes_globals/Set/prototype +translation_of: Web/JavaScript/Reference/Global_Objects/Set +translation_of_original: Web/JavaScript/Reference/Global_Objects/Set/prototype +--- +<div>{{JSRef}}</div> + +<p>La propietat <code><strong>Set</strong></code><strong><code>.prototype</code></strong> representa el prototipus per al constructor de {{jsxref("Set")}}.</p> + +<div>{{js_property_attributes(0,0,0)}}</div> + +<h2 id="Descripció">Descripció</h2> + +<p>Les instàncies de {{jsxref("Set")}} hereten de {{jsxref("Set.prototype")}}. Es pot utilitzar el l'objecte prototipus del constructor per a afegir propietats o mètodes a totes les instàncies de <code>Set</code>.</p> + +<h2 id="Propietats">Propietats</h2> + +<dl> + <dt><code>Set.prototype.constructor</code></dt> + <dd>Retorna la funció que ha creat la instància del prototipus. Per defecte es tracta de la funció {{jsxref("Set")}}.</dd> + <dt>{{jsxref("Set.prototype.size")}}</dt> + <dd>Retorna el nombre de valors emmagatzemats dins l'objecte <code>Set</code>.</dd> +</dl> + +<h2 id="Mètodes">Mètodes</h2> + +<dl> + <dt>{{jsxref("Set.add", "Set.prototype.add(valor)")}}</dt> + <dd>Afegeix un nou element a l'objecte <code>Set</code> amb el valor donat. Retorna l'objecte <code>Set</code>.</dd> + <dt>{{jsxref("Set.prototype.clear()")}}</dt> + <dd>Elimina tots els elements de l'objecte <code>Set</code>.</dd> + <dt>{{jsxref("Set.delete", "Set.prototype.delete(valor)")}}</dt> + <dd>Elimina l'element associat a <code>valor</code> i retorna el que el mètode <code>Set.prototype.has(valor)</code> hagués retornat prèviament a aquesta crida. Després d'aquesta crida <code>Set.prototype.has(valor)</code> retornarà <code>false</code>.</dd> + <dt>{{jsxref("Set.prototype.entries()")}}</dt> + <dd>Retorna un nou objecte <code>Iterator</code> que conté <strong>un array de la forma <code>[valor, valor]</code></strong> per a cada element dins l'objecte <code>Set</code>, en ordre d'inserció. El array retornat manté similitud amb el comportament de l'objecte <code>Map</code>, de forma que cada entrada té el mateix valor per a la seva <em>clau</em> i <em>valor</em>.</dd> + <dt>{{jsxref("Set.forEach", "Set.prototype.forEach(callbackFn[, thisArg])")}}</dt> + <dd>Crida <code>callbackFn</code> per a cada valor present a l'objecte <code>Set</code>, recorreguts per ordre d'inserció. Si es proporciona el paràmetre <code>thisArg</code>, aquest s'utilitzarà com a valor de <em>this</em> per a cada crida a <code>callbackFn</code>.</dd> + <dt>{{jsxref("Set.has", "Set.prototype.has(value)")}}</dt> + <dd>Retorna un booleà que especifica si la clau té un valor associat en aquest objecte <code>Set</code> o no.</dd> + <dt>{{jsxref("Set.prototype.keys()")}}</dt> + <dd>Es tracta de la mateixa funció que la funció <strong><code>values()</code></strong> i retorna un nou objecte <code>Iterator</code> que conté els valors per a cada element de l'objecte <code>Set</code>, en ordre d'inserció.</dd> + <dt>{{jsxref("Set.prototype.values()")}}</dt> + <dd>Retorna un nou objecte <code>Iterator</code> que conté els <strong>valors</strong><strong> </strong>de cada element de l'objecte <code>Set</code>, en ordre d'inserció.</dd> + <dt>{{jsxref("Set.prototype.@@iterator()", "Set.prototype[@@iterator]()")}}</dt> + <dd>Retorna un nou objecte <code>Iterator</code> que conté els <strong>valors</strong><strong> </strong>de cada element de l'objecte <code>Set</code>, en ordre d'inserció.</dd> +</dl> + +<h2 id="Especificacions">Especificacions</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Especificació</th> + <th scope="col">Estat</th> + <th scope="col">Comentaris</th> + </tr> + <tr> + <td>{{SpecName('ES6', '#sec-set.prototype', 'Set.prototype')}}</td> + <td>{{Spec2('ES6')}}</td> + <td>Definició inicial.</td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilitat_amb_navegadors">Compatibilitat amb navegadors</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Característica</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Suport bàsic</td> + <td>38</td> + <td>{{ CompatGeckoDesktop("13") }}</td> + <td>11</td> + <td>25</td> + <td>7.1</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Característica</th> + <th>Android</th> + <th>Chrome for Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Suport bàsic</td> + <td>{{CompatNo}}</td> + <td>38</td> + <td>{{ CompatGeckoMobile("13") }}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td> + <p>8</p> + </td> + </tr> + </tbody> +</table> +</div> + +<h2 id="Vegeu_també">Vegeu també</h2> + +<ul> + <li>{{jsxref("Map.prototype")}}</li> +</ul> |