Skip to content
Related Articles

Related Articles

Improve Article
JavaScript Number.MAX_VALUE & Number.MIN_VALUE Property
  • Last Updated : 08 Sep, 2020

Below is the example of the Number.MAX_VALUE & Number.MIN_VALUE Property.

  • Example:




    <script> 
    function GFGFun() { 
        document.write(Number.MAX_VALUE+"<br>");
        document.write(Number.MIN_VALUE+"<br>");
    GFGFun(); 
    </script> 
  • Output :
    1.7976931348623157e+308
    5e-324
    

Number.MAX_VALUE and Number.MIN_VALUE is used to represent maximum and minimum numeric value in javascript.

Syntax:

Number.MAX_VALUE 
Number.MIN_VALUE 

Return Type:
Both Number.MAX_VALUE and Number.MIN_VALUE returns a numeric value.

  • MAX_VALUE has a value of approximately 1.79E+308. The values which are larger Number.MAX_VALUE are termed as Infinity.
  • MIN_VALUE has a value of approximately 5e-324. The values which are smaller than Number.MIN_VALUE are termed as underflow values.
  • Both MAX_VALUE and MIN_VALUE are static property of Number. Therefore using x.MAX_VALUE or x.MIN_VALUE will return undefined where x is a Number or Number Object.

Example 1:



Input : Number.MAX_VALUE
Output : 1.7976931348623157e+308

Example 2:

Input : Number.MIN_VALUE
Output : 5e-324

Program:




<script> 
  
function GFGFun() { 
    // JavaScript Code to illustrate Number.MAX_VALUE
    // & Number.MIN_VALUE
    document.write(Number.MAX_VALUE+"<br>");
    document.write(Number.MIN_VALUE+"<br>");
  
    // Undefined Behaviour 
    var res = 1; 
    res = res.MAX_VALUE; 
    document.write(res); 
GFGFun(); 
</script> 

Output :

1.7976931348623157e+308
5e-324
undefined
My Personal Notes arrow_drop_up
Recommended Articles
Page :