JavaScript | Number.MAX_VALUE & Number.MIN_VALUE with Examples

Number.MAX_VALUE and Number.MIN_VALUE are 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.
filter_none

edit
close

play_arrow

link
brightness_4
code

<script>
  
    // JavaScript Code to illustrate Number.MAX_VALUE
    // & Number.MIN_VALUE
  
    function func() {
        // MAX_VALUE
        var a = Number.MAX_VALUE;
        document.write(a);
  
        // New Line
        document.write("<br>");
  
        // MIN_VALUE
        a = Number.MIN_VALUE;
  
        document.write(a);
  
        // New Line
        document.write("<br>");
        a = 1
            // Undefined Behaviour
            document.write(a.MAX_VALUE);
    }
  
func();
< /script>                    

chevron_right


Output :
1.7976931348623157e+308
5e-324
undefined



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.