aboutsummaryrefslogtreecommitdiff
path: root/files/pt-br/web/javascript/reference/global_objects/object/propertyisenumerable/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
commit074785cea106179cb3305637055ab0a009ca74f2 (patch)
treee6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/pt-br/web/javascript/reference/global_objects/object/propertyisenumerable/index.html
parentda78a9e329e272dedb2400b79a3bdeebff387d47 (diff)
downloadtranslated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz
translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2
translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip
initial commit
Diffstat (limited to 'files/pt-br/web/javascript/reference/global_objects/object/propertyisenumerable/index.html')
-rw-r--r--files/pt-br/web/javascript/reference/global_objects/object/propertyisenumerable/index.html128
1 files changed, 128 insertions, 0 deletions
diff --git a/files/pt-br/web/javascript/reference/global_objects/object/propertyisenumerable/index.html b/files/pt-br/web/javascript/reference/global_objects/object/propertyisenumerable/index.html
new file mode 100644
index 0000000000..a68117bc0c
--- /dev/null
+++ b/files/pt-br/web/javascript/reference/global_objects/object/propertyisenumerable/index.html
@@ -0,0 +1,128 @@
+---
+title: Object.prototype.propertyIsEnumerable()
+slug: Web/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable
+translation_of: Web/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable
+---
+<div>{{JSRef}}</div>
+
+<p>O método <code><strong>propertyIsEnumerable()</strong></code> retorna um booleano indicando quando a propriedade especificada é enumerável e é a propriedade do próprio objeto</p>
+
+<div>{{EmbedInteractiveExample("pages/js/object-prototype-propertyisenumerable.html", "taller")}}</div>
+
+<p class="hidden">O source deste exemplo interativo é armazenado em um repositório GitHub.Se você deseja contribuir com o projeto de exemplos interativos, vá em:<a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> e nos envie uma solicitação</p>
+
+<h2 id="Sintaxe">Sintaxe</h2>
+
+<pre class="syntaxbox notranslate"><code><var>obj</var>.propertyIsEnumerable(<var>prop</var>)</code></pre>
+
+<h3 id="Parâmetros">Parâmetros</h3>
+
+<dl>
+ <dt><code>prop</code></dt>
+ <dd>O nome da propriedade para teste</dd>
+</dl>
+
+<h3 id="Valor_de_Retorno">Valor de Retorno</h3>
+
+<p>O {{jsxref("Boolean")}} indicando se a propriedade especificada é enumeravel e é a propriedade do objeto</p>
+
+<h2 id="Descrição">Descrição</h2>
+
+<p>Every object has a <code>propertyIsEnumerable</code> method. This method can determine whether the specified property in an object can be enumerated by a {{jsxref("Statements/for...in", "for...in")}} loop, with the exception of properties inherited through the prototype chain. If the object does not have the specified property, this method returns <code>false</code>.</p>
+
+<h2 id="Exemplos">Exemplos</h2>
+
+<h3 id="O_uso_basico_de_propertyIsEnumerable">O uso basico de <code>propertyIsEnumerable</code></h3>
+
+<p>O exemplos a seguir mostram o uso de <code>propertyIsEnumerable</code> em um objeto e um array:</p>
+
+<pre class="brush: js notranslate">var o = {};
+var a = [];
+o.prop = 'is enumerable';
+a[0] = 'is enumerable';
+
+o.propertyIsEnumerable('prop'); // returns true
+a.propertyIsEnumerable(0); // returns true
+</pre>
+
+<h3 id="Objetos_User-defined_vs._built-in">Objetos User-defined vs. built-in</h3>
+
+<p>Os exemplos a seguir demostram a enumerabilidade da propriedade user-defined vs. built-in :</p>
+
+<pre class="brush: js notranslate">var a = ['is enumerable'];
+
+a.propertyIsEnumerable(0); // returns true
+a.propertyIsEnumerable('length'); // returns false
+
+Math.propertyIsEnumerable('random'); // returns false
+this.propertyIsEnumerable('Math'); // returns false
+</pre>
+
+<h3 id="Propriedade_Direct_vs._inherited">Propriedade Direct vs. inherited</h3>
+
+<pre class="brush: js notranslate">var a = [];
+a.propertyIsEnumerable('constructor'); // returns false
+
+function firstConstructor() {
+ this.property = 'is not enumerable';
+}
+
+firstConstructor.prototype.firstMethod = function() {};
+
+function secondConstructor() {
+ this.method = function() { return 'is enumerable'; };
+}
+
+secondConstructor.prototype = new firstConstructor;
+secondConstructor.prototype.constructor = secondConstructor;
+
+var o = new secondConstructor();
+o.arbitraryProperty = 'is enumerable';
+
+o.propertyIsEnumerable('arbitraryProperty'); // returns true
+o.propertyIsEnumerable('method'); // returns true
+o.propertyIsEnumerable('property'); // returns false
+
+o.property = 'is enumerable';
+
+o.propertyIsEnumerable('property'); // returns true
+
+// These return false as they are on the prototype which
+// propertyIsEnumerable does not consider (even though the last two
+// are iteratable with for-in)
+o.propertyIsEnumerable('prototype'); // returns false (as of JS 1.8.1/FF3.6)
+o.propertyIsEnumerable('constructor'); // returns false
+o.propertyIsEnumerable('firstMethod'); // returns false
+</pre>
+
+<h2 id="Especificações">Especificações</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-object.prototype.propertyisenumerable', 'Object.prototype.propertyIsEnumerable')}}</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatibilidade_com_Navegadores">Compatibilidade com Navegadores</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Object.propertyIsEnumerable")}}</p>
+</div>
+
+<h2 id="Veja_também">Veja também</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties">Enumerability and ownership of properties</a></li>
+ <li>{{jsxref("Statements/for...in", "for...in")}}</li>
+ <li>{{jsxref("Object.keys()")}}</li>
+ <li>{{jsxref("Object.defineProperty()")}}</li>
+</ul>