Tutorials Point

  JavaScript Basics
  JavaScript Objects
  JavaScript Advanced
  JS Useful References
  JS Useful Resources
  Selected Reading

Copyright © 2014 by tutorialspoint

  Home     References     Discussion Forums     About TP  

Javascript Number - POSITIVE_INFINITY

previous next AddThis Social Bookmark Button



This is a special numeric value representing any value greater than Number.MAX_VALUE. This value is represented as "Infinity". This value resembles an infinity in its mathematical behavior. For example, anything multiplied by POSITIVE_INFINITY is POSITIVE_INFINITY, and anything divided by POSITIVE_INFINITY is zero.

Because POSITIVE_INFINITY is a constant, it is a read-only property of Number.


You can access this property using the following syntax:

var val = Number.POSITIVE_INFINITY;


Here is an example showing usage of this property:

<script type="text/javascript">
function showValue()
   var bigNumber = Number.MAX_VALUE * 2
   if (bigNumber == Number.POSITIVE_INFINITY) {
      alert("Value of bigNumber : " + bigNumber );
<p>Click the following to see the result:</p>
<input type="button" value="Click Me" onclick="showValue();" />

This will produce following result:

Value of val : Infinity

To understand it in better way you can Try it yourself.

previous next Printer Friendly