aboutsummaryrefslogtreecommitdiff
path: root/files/pt-br/web/javascript/reference/global_objects/set/add/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/pt-br/web/javascript/reference/global_objects/set/add/index.html')
-rw-r--r--files/pt-br/web/javascript/reference/global_objects/set/add/index.html131
1 files changed, 131 insertions, 0 deletions
diff --git a/files/pt-br/web/javascript/reference/global_objects/set/add/index.html b/files/pt-br/web/javascript/reference/global_objects/set/add/index.html
new file mode 100644
index 0000000000..c3787149df
--- /dev/null
+++ b/files/pt-br/web/javascript/reference/global_objects/set/add/index.html
@@ -0,0 +1,131 @@
+---
+title: Set.prototype.add()
+slug: Web/JavaScript/Reference/Global_Objects/Set/add
+tags:
+ - ECMAScript6
+ - JavaScript
+ - Prototype
+ - metodo
+ - set
+ - set.add
+translation_of: Web/JavaScript/Reference/Global_Objects/Set/add
+---
+<div>{{JSRef}}</div>
+
+<p>O método <code><strong>add()</strong></code> acrescenta um novo elemento com o valor especificado no final de um objeto <code>Set</code>.</p>
+
+<h2 id="Sintaxe">Sintaxe</h2>
+
+<pre class="syntaxbox"><code><em>mySet</em>.add(value);</code></pre>
+
+<h3 id="Parâmetros">Parâmetros</h3>
+
+<dl>
+ <dt>value</dt>
+ <dd>Requerido. O valor de um elemento a ser adicionado ao objeto Set.</dd>
+</dl>
+
+<h3 id="Valor_de_retorno">Valor de retorno</h3>
+
+<p><font face="Open Sans, Arial, sans-serif">O objeto </font><code>Set</code>.</p>
+
+<h2 id="Exemplos">Exemplos</h2>
+
+<h3 id="Usando_o_método_add">Usando o método <code>add</code></h3>
+
+<pre class="brush: js">var mySet = new Set();
+
+mySet.add(1);
+mySet.add(5).add("some text"); // pode ser encadeado
+
+console.log(mySet);
+// Set [1, 5, "some text"]
+</pre>
+
+<h2 id="Especificações">Especificações</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Especificações</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comentário</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-set.prototype.add', 'Set.prototype.add')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Definição inicial.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-set.prototype.add', 'Set.prototype.add')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatilidade_de_Navegadores_(Browser)">Compatilidade de Navegadores (Browser)</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>Suporte Básico</td>
+ <td>38</td>
+ <td>{{CompatGeckoDesktop("13.0")}}</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>Feature</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>Suporte Básico</td>
+ <td>{{CompatNo}}</td>
+ <td>38</td>
+ <td>{{CompatGeckoMobile("13.0")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>8</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="Notas_específicas_para_Firefox">Notas específicas para Firefox</h2>
+
+<ul>
+ <li>Antes do Firefox 33 {{geckoRelease("33")}}, <code>Set.prototype.add retornava</code> <code>undefined</code> e não era possível encadear chamadas. Isto foi resolvido ({{bug(1031632)}}). O comportamento pode ser encontrado no Chrome/v8 (<a href="https://code.google.com/p/v8/issues/detail?id=3410">issue</a>).</li>
+</ul>
+
+<h2 id="Veja_também">Veja também</h2>
+
+<ul>
+ <li>{{jsxref("Set")}}</li>
+ <li>{{jsxref("Set.prototype.delete()")}}</li>
+ <li>{{jsxref("Set.prototype.has()")}}</li>
+</ul>