Infinity
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
全域 Infinity
屬性是一個表示無窮大的數值。
Property attributes of Infinity 的屬性特性 | |
---|---|
可寫 | 否 |
可列舉 | 否 |
可配置 | 否 |
語法
js
Infinity
描述
Infinity
是全域物件屬性,即它是全域範圍內的變數。
Infinity
的初始值是 Number.POSITIVE_INFINITY
Infinity
值(正無窮大)值大於其他任何數值。該值在數學上表現為無窮大。例如,任何乘以 Infinity
的正整數都是 Infinity
,除以 Infinity
的任何數都是 0。
按照 ECMAScript 5 規範,在 JavaScript 1.8.5 / Firefox 4 實作的 Infinity
乃唯讀屬性。
範例
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 */
規範
Specification |
---|
ECMAScript® 2025 Language Specification # sec-value-properties-of-the-global-object-infinity |
瀏覽器相容性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Infinity |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.