aboutsummaryrefslogtreecommitdiff
path: root/files/pt-pt/web/javascript/reference/global_objects/infinity/index.html
blob: 818471e60e20a8c781dccdff514e42ea7ddf6d9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
title: Infinity
slug: Web/JavaScript/Reference/Global_Objects/Infinity
tags:
  - JavaScript
  - Propriedade
  - Referencia
translation_of: Web/JavaScript/Reference/Global_Objects/Infinity
---
<div>{{jsSidebar("Objects")}}</div>

<p>A propriedade global <code><strong>Infinity</strong></code> é um valor numérico que representa o infinito.</p>

<p>{{js_property_attributes(0,0,0)}}</p>

<div>{{EmbedInteractiveExample("pages/js/globalprops-infinity.html")}}</div>

<div class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> and send us a pull request.</div>

<h2 id="Descrição">Descrição</h2>

<p><code>Infinity</code> é uma propriedade do objeto <code>global</code>. Isto é para dizer que é um variável com um escopo global.</p>

<p>O valor inicial do <code>Infinity</code> é {{jsxref("Number.POSITIVE_INFINITY")}}. O valor <code>Infinity</code> (infinito positivo) é maior que qualquer outro número.</p>

<p>Este valor age de form diferente do infinito matematico; veja {{jsxref("Number.POSITIVE_INFINITY")}} para mais detalhes.</p>

<p>Como definido na especificação ECMAScript 5, <code>Infinity</code> é <em>read-only</em> (implementado em JavaScript 1.8.5 / Firefox 4).</p>

<h2 id="Exemplos">Exemplos</h2>

<h3 id="Usar_Infinity">Usar Infinity</h3>

<pre class="brush: js notranslate">console.log(Infinity          ); /* Infinity */
console.log(Infinity + 1      ); /* Infinity */
console.log(Math.pow(10, 1000)); /* Infinity */
console.log(Math.log(0)       ); /* -Infinity */
console.log(1 / Infinity      ); /* 0 */
console.log(1 / 0             ); /* Infinity */
</pre>

<h2 id="Especificações">Especificações</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Especificação</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('ESDraft', '#sec-value-properties-of-the-global-object-infinity', 'Infinity')}}</td>
  </tr>
 </tbody>
</table>

<h2 id="Compatibilidade">Compatibilidade</h2>



<p>{{Compat("javascript.builtins.Infinity")}}</p>

<h2 id="Veja_também">Veja também</h2>

<ul>
 <li>{{jsxref("Number.NEGATIVE_INFINITY")}}</li>
 <li>{{jsxref("Number.POSITIVE_INFINITY")}}</li>
 <li>{{jsxref("Number.isFinite")}}</li>
</ul>