aboutsummaryrefslogtreecommitdiff
path: root/files/pt-pt/web/javascript/reference/global_objects/number/isinteger/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/pt-pt/web/javascript/reference/global_objects/number/isinteger/index.html')
-rw-r--r--files/pt-pt/web/javascript/reference/global_objects/number/isinteger/index.html125
1 files changed, 125 insertions, 0 deletions
diff --git a/files/pt-pt/web/javascript/reference/global_objects/number/isinteger/index.html b/files/pt-pt/web/javascript/reference/global_objects/number/isinteger/index.html
new file mode 100644
index 0000000000..8c6dc79bb7
--- /dev/null
+++ b/files/pt-pt/web/javascript/reference/global_objects/number/isinteger/index.html
@@ -0,0 +1,125 @@
+---
+title: Number.isInteger()
+slug: Web/JavaScript/Reference/Global_Objects/Number/isInteger
+tags:
+ - Experimental
+ - JavaScript
+ - Method
+ - Método(2)
+ - Number
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Number/isInteger
+---
+<div>{{JSRef}}</div>
+
+<p>O método <strong><code>Number.isInteger()</code></strong> determina se o valor passado é um inteiro.</p>
+
+<h2 id="Sintaxe">Sintaxe</h2>
+
+<pre class="syntaxbox"><code>Number.isInteger(valor)</code></pre>
+
+<h3 id="Parâmteros">Parâmteros</h3>
+
+<dl>
+ <dt><code>valor</code></dt>
+ <dd>O valor a ser testado por ser um inteiro.</dd>
+</dl>
+
+<h2 id="Descrição">Descrição</h2>
+
+<p>Se o valor a ser testado for um inteiro, retorna <code>true</code>, senão retorna <code>false</code>. Se o valor for {{jsxref("Global_Objects/NaN", "NaN")}} ou infinito, retorna <code>false</code>.</p>
+
+<h2 id="Exemplos">Exemplos</h2>
+
+<pre class="brush: js">Number.isInteger(0.1); // false
+Number.isInteger(1); // true
+Number.isInteger(Math.PI); // false
+Number.isInteger(-100000); // true
+Number.isInteger(NaN); // false
+Number.isInteger(0); // true
+Number.isInteger("10"); // false
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<pre class="brush: js">Number.isInteger = Number.isInteger || function(value) {
+ return typeof value === "number" &amp;&amp;
+  isFinite(value) &amp;&amp;
+  Math.floor(value) === value;
+};
+</pre>
+
+<h2 id="Especificações">Especificações</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Especificação</th>
+ <th scope="col">Estado</th>
+ <th scope="col">Comentário</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-number.isinteger', 'Number.isInteger')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Definição inicial.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatibilidade_dos_browsers">Compatibilidade dos browsers</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Funcionalidade</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>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("16")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Funcionalidade</th>
+ <th>Android</th>
+ <th>Chrome para 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>{{CompatNo}}</td>
+ <td>{{CompatGeckoMobile("16")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="Ver_também">Ver também</h2>
+
+<ul>
+ <li>O objecto {{jsxref("Global_Objects/Number", "Number")}} ao qual pertence.</li>
+</ul>