Saturday, November 16, 2024
Google search engine
HomeLanguagesJavascriptJavaScript Number MAX_VALUE & MIN_VALUE Property

JavaScript Number MAX_VALUE & MIN_VALUE Property

JavaScript Number.MAX_VALUE and Number.MIN_VALUE is used to represent maximum and minimum numeric values 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 are larger Number.MAX_VALUE are termed as Infinity. 
  • MIN_VALUE has a value of approximately 5e-324. The values are smaller than the Number.MIN_VALUE are termed as underflow values. 
  • Both MAX_VALUE and MIN_VALUE are static properties of Number. Therefore using x.MAX_VALUE or x.MIN_VALUE will return undefined where x is a Number or Number Object.

Example 1: In this example, we will print the maximum value

javascript




function GFGFun() {
    // Undefined Behaviour
    let res = Number.MAX_VALUE;
    console.log(res);
}
GFGFun();


Output : 

1.7976931348623157e+308

Example 2: In this example, we will print the minimum value

Javascript




function GFGFun() {
    // Undefined Behaviour
    let res = Number.MIN_VALUE;
    console.log(res);
}
GFGFun();


Output:

5e-324

Supported Browsers:

  • Chrome 34 and above
  • Internet Explorer (Not Supported)
  • Firefox 31 and above
  • Edge 12 and above
  • Safari 9 and above
  • Opera 21 and above

We have a complete list of JavaScript Number constructor, properties, and methods list, to know more about the numbers please go through that article.

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments