无穷

Infinity 全局属性是表示无穷大的数值。

¥The Infinity global property is a numeric value representing infinity.

Try it

¥Value

Number.POSITIVE_INFINITY 相同的数值。

¥The same number value as Number.POSITIVE_INFINITY.

Property attributes of 无穷
Writable no
Enumerable no
Configurable no

描述

¥Description

Infinity 是全局对象的属性。换句话说,它是全局范围内的变量。

¥Infinity is a property of the global object. In other words, it is a variable in global scope.

Infinity(正无穷)大于任何其他数字。

¥The value Infinity (positive infinity) is greater than any other number.

该值的表现与数学无穷大略有不同;详情请参见 Number.POSITIVE_INFINITY

¥This value behaves slightly differently than mathematical infinity; see Number.POSITIVE_INFINITY for details.

示例

¥Examples

使用无穷大

¥Using 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 */
console.log(1 / 0); /* Infinity */

规范

Specification
ECMAScript Language Specification
# sec-value-properties-of-the-global-object-infinity

¥Specifications

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看