English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript POSITIVE_INFINITY Property

 JavaScript Number Object

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.

Syntax:

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

Browser Compatibility

All browsers fully support the POSITIVE_INFINITY property:

Properties
POSITIVE_INFINITYYesYesYesYesYes

Technical Details

Writable:None
Enumerable:None
Configurable:None
Return Value:Infinity
JavaScript Version:ECMAScript 1

More Examples

Returns POSITIVE_INFINITY when overflow occurs:

var num = 5 / 0;
Test and see‹/›

 JavaScript Number Object