JavaScript Number Positive_INFINITY property
Below is the example of the Number Positive_INFINITY property.
- Example:
<script>vara = Number.POSITIVE_INFINITY;document.write(a * 10);</script> - Output:
Infinity
In javascript Number.POSITIVE_INFINITY represents the largest positive value i.e positive infinity. Actually value of Number.POSITIVE_INFINITY is the same as the value of the global object’s Infinity property.
Syntax:
It can be assigned to a variable in the following way.
var a = Number.POSITIVE_INFINITY
Now, we know what is Number.POSITIVE_INFINITY, let’s look at some examples to see the result of some arithmetic operations performed on Number.POSITIVE_INFINITY.
- Example 1: When we multiply any positive number including Number.POSITIVE_INFINITY by Number.POSITIVE_INFINITY the result is Number.POSITIVE_INFINITY.
<script>vara = Number.POSITIVE_INFINITY;document.write(a * 2);</script>Output:
Infinity
- Example 2: When we multiply any negative number with Number.POSITIVE_INFINITY the result is negative Infinity.
<script>vara = Number.POSITIVE_INFINITY;document.write(a * -2);<script>Output:
Infinity
- Example 3: When we divide any positive or negative number by Number.POSITIVE_INFINITY the result is 0.
<script>vara = Number.POSITIVE_INFINITY;document.write(2 / a);</script>Output:
0
- Example 4: When we multiply Number.POSITIVE_INFINITY by 0, result is NaN.
<script>vara = Number.POSITIVE_INFINITY;document.write(a * 0);</script>Output:
NaN
- Example 5: When we divide Number.POSITIVE_INFINITY by any negative number except Number.NEGATIVE_INFINITY, result is Number.NEGATIVE_INFINITY.
<script>vara = Number.POSITIVE_INFINITY;document.write(a / -2);</script>Output:
Infinity
- Example 6: When we divide Number.POSITIVE_INFINITY by any positive number except Number.POSITIVE_INFINITY, result is Number.POSITIVE_INFINITY.
<script>vara = Number.POSITIVE_INFINITY;document.write(a / 2);</script>Output:
Infinity
- Example 7: When we divide Number.POSITIVE_INFINITY by either NEGATIVE_INFINITY or POSITIVE_INFINITY, result is NaN.
<script>vara = Number.POSITIVE_INFINITY;varb = Number.NEGATIVE_INFINITY;document.write(a / b);</script>Output:
NaN
Supported Browsers:
- Google Chrome
- Internet Explorer
- Firefox
- Apple Safari
- Opera


