--- title: Infinity slug: Web/JavaScript/Reference/Global_Objects/Infinity translation_of: Web/JavaScript/Reference/Global_Objects/Infinity --- <div>{{jsSidebar("Objects")}}</div> <p>全域 <code><strong>Infinity</strong></code> 屬性是一個表示無窮大的數值。</p> <p>{{js_property_attributes(0,0,0)}}</p> <h2 id="語法">語法</h2> <pre class="syntaxbox"><code>Infinity </code></pre> <h2 id="描述">描述</h2> <p><code>Infinity</code> 是全域物件屬性,即它是全域範圍內的變數。</p> <p><code>Infinity</code> 的初始值是 {{jsxref("Number.POSITIVE_INFINITY")}} <code>Infinity</code> 值(正無窮大)值大於其他任何數值。該值在數學上表現為無窮大。例如,任何乘以 <code>Infinity</code> 的正整數都是 <code>Infinity</code>,除以 <code>Infinity</code> 的任何數都是 0。</p> <p>按照 ECMAScript 5 規範,在 JavaScript 1.8.5 / Firefox 4 實作的 <code>Infinity</code> 乃唯讀屬性。</p> <h2 id="範例">範例</h2> <pre class="brush: js">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 */ </pre> <h2 id="規範">規範</h2> <table class="standard-table"> <tbody> <tr> <th scope="col">規範</th> <th scope="col">狀態</th> <th scope="col">註解</th> </tr> <tr> <td>{{SpecName('ES1')}}</td> <td>{{Spec2('ES1')}}</td> <td>初始定義。在 JavaScript 1.3 實作。</td> </tr> <tr> <td>{{SpecName('ES5.1', '#sec-15.1.1.2', 'Infinity')}}</td> <td>{{Spec2('ES5.1')}}</td> <td> </td> </tr> <tr> <td>{{SpecName('ES6', '#sec-value-properties-of-the-global-object-infinity', 'Infinity')}}</td> <td>{{Spec2('ES6')}}</td> <td> </td> </tr> <tr> <td>{{SpecName('ESDraft', '#sec-value-properties-of-the-global-object-infinity', 'Infinity')}}</td> <td>{{Spec2('ESDraft')}}</td> <td> </td> </tr> </tbody> </table> <h2 id="瀏覽器相容性">瀏覽器相容性</h2> <p>{{Compat("javascript.builtins.Infinity")}}</p> <h2 id="參見">參見</h2> <ul> <li>{{jsxref("Number.NEGATIVE_INFINITY")}}</li> <li>{{jsxref("Number.POSITIVE_INFINITY")}}</li> <li>{{jsxref("Number.isFinite")}}</li> </ul>