JavaScript Number.MAX_VALUE & Number.MIN_VALUE Property

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

  • Example:
    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <script> 
    function GFGFun() { 
        document.write(Number.MAX_VALUE+"<br>");
        document.write(Number.MIN_VALUE+"<br>");
    GFGFun(); 
    </script> 

    chevron_right

    
    

  • 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:

filter_none

edit
close

play_arrow

link
brightness_4
code

<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> 

chevron_right


Output :

1.7976931348623157e+308
5e-324
undefined

full-stack-img

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.