English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
POSITIVE_INFINITYproperty represents the positive infinity value.
The value of Number.POSITIVE_INFINITY is the same as the global object'sInfinityattribute values are the same.
Because POSITIVE_INFINITY is a static property of Number, you should always use it asNumber.POSITIVE_INFINITYrather than using it as an attribute of the created Number object.
Number.POSITIVE_INFINITY
Number.POSITIVE_INFINITY;Test and see‹/›
The behavior of the return value is slightly different from mathematical infinity:
Any positive value (including POSITIVE_INFINITY) multiplied by POSITIVE_INFINITY is POSITIVE_INFINITY
Any negative value (including NEGATIVE_INFINITY) multiplied by POSITIVE_INFINITY results in NEGATIVE_INFINITY
Any positive number divided by POSITIVE_INFINITY results in positive zero
Any negative number divided by POSITIVE_INFINITY results in negative zero
Zero multiplied by POSITIVE_INFINITY results in NaN
NaN multiplied by POSITIVE_INFINITY is NaN
POSITIVE_INFINITY divided by any negative value other than NEGATIVE_INFINITY is NEGATIVE_INFINITY
POSITIVE_INFINITY divided by any positive value other than POSITIVE_INFINITY is POSITIVE_INFINITY
POSITIVE_INFINITY divided by NEGATIVE_INFINITY or POSITIVE_INFINITY results in NaN
All browsers fully support the POSITIVE_INFINITY property:
Properties | |||||
POSITIVE_INFINITY | Yes | Yes | Yes | Yes | Yes |
Writable: | None |
---|---|
Enumerable: | None |
Configurable: | None |
Return Value: | Infinity |
JavaScript Version: | ECMAScript 1 |
Returns POSITIVE_INFINITY when overflow occurs:
var num = 5 / 0;Test and see‹/›