aboutsummaryrefslogtreecommitdiff
path: root/files/ca/web/javascript/reference/global_objects/weakmap/get
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:15 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:15 -0500
commit4b1a9203c547c019fc5398082ae19a3f3d4c3efe (patch)
treed4a40e13ceeb9f85479605110a76e7a4d5f3b56b /files/ca/web/javascript/reference/global_objects/weakmap/get
parent33058f2b292b3a581333bdfb21b8f671898c5060 (diff)
downloadtranslated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.tar.gz
translated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.tar.bz2
translated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.zip
initial commit
Diffstat (limited to 'files/ca/web/javascript/reference/global_objects/weakmap/get')
-rw-r--r--files/ca/web/javascript/reference/global_objects/weakmap/get/index.html115
1 files changed, 115 insertions, 0 deletions
diff --git a/files/ca/web/javascript/reference/global_objects/weakmap/get/index.html b/files/ca/web/javascript/reference/global_objects/weakmap/get/index.html
new file mode 100644
index 0000000000..f69ca1aa58
--- /dev/null
+++ b/files/ca/web/javascript/reference/global_objects/weakmap/get/index.html
@@ -0,0 +1,115 @@
+---
+title: WeakMap.prototype.get()
+slug: Web/JavaScript/Reference/Global_Objects/WeakMap/get
+translation_of: Web/JavaScript/Reference/Global_Objects/WeakMap/get
+---
+<div>{{JSRef}}</div>
+
+<p>El mètode <code><strong>get()</strong></code> retorna un element especificat d'un objecte <code>WeakMap.</code></p>
+
+<h2 id="Sintaxi">Sintaxi</h2>
+
+<pre class="syntaxbox"><code><em>wm</em>.get(key);</code></pre>
+
+<h3 id="Paràmetres">Paràmetres</h3>
+
+<dl>
+ <dt>key</dt>
+ <dd>Necessari. La clau d'un element a retornar de l'objecte <code>WeakMap.</code></dd>
+</dl>
+
+<h3 id="Valor_a_retornar">Valor a retornar</h3>
+
+<p>Retorna l'element associat a la clau especificada o <code>undefined</code> si no es pot trobar la clau en l'objecte <code>WeakMap.</code></p>
+
+<h2 id="Exemples">Exemples</h2>
+
+<h3 id="Utilitzar_el_mètode_get">Utilitzar el mètode <code>get</code></h3>
+
+<pre class="brush: js">var wm = new WeakMap();
+wm.set(window, "foo");
+
+wm.get(window); // Retorna "foo".
+wm.get("baz"); // Retorna undefined.
+</pre>
+
+<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-weakmap.prototype.get', 'WeakMap.prototype.get')}}</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>36</td>
+ <td>{{CompatGeckoDesktop("6.0")}}</td>
+ <td>11</td>
+ <td>23</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>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>{{CompatGeckoMobile("6.0")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>8</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="Notes_específiques_per_a_Firefox">Notes específiques per a Firefox</h2>
+
+<ul>
+ <li>Abans de SpiderMonkey 38 {{geckoRelease(38)}}, aquest mètode llençava un {{jsxref("TypeError")}} quan no es trobava el paràmetre key en l'objecte. Tot i així, l'últim estàndard ES6 especifica que en comptes d'això es retorni <code>undefined.</code> És més, <code>WeakMap.prototype.get</code> acceptava un segon argument opcional com a valor com a pla B, el qual no forma part de l'estàndard. Ambdós comportaments no estàndards s'han eliminat en la versió 38 i posterior ({{bug(1127827)}}).</li>
+</ul>
+
+<h2 id="Vegeu_també">Vegeu també</h2>
+
+<ul>
+ <li>{{jsxref("WeakMap")}}</li>
+ <li>{{jsxref("WeakMap.set()")}}</li>
+ <li>{{jsxref("WeakMap.has()")}}</li>
+</ul>