What is Number.NEGATIVE_INFINITY constant in JavaScript?

JavascriptWeb DevelopmentFront End Technology

Number.NEGATIVE_INFINITY is a special numeric value representing a value less than Number.MIN_VALUE. This value is represented as "-Infinity". It resembles infinity in its mathematical behavior.


You can try to run the following code to learn how to work with Number.NEGATIVE_INFINITY constant −

Live Demo

            function showValue() {
               var smallNumber = (-Number.MAX_VALUE) * 2
               if (smallNumber == Number.NEGATIVE_INFINITY) {
                  alert("Value of smallNumber : " + smallNumber );

      <p>Click the following to see the result:</p>
         <input type="button" value="Click Me" onclick="showValue();" />
Published on 18-Jan-2018 11:56:19