JavaScript: Number.MAX_VALUE property
This JavaScript tutorial explains how to use the Number property called MAX_VALUE with syntax and examples.
Description
In JavaScript, MAX_VALUE is a static property of the Number object that is used to return the maximum numeric value that can be represented in JavaScript. Because MAX_VALUE is a property of the Number object, it must be invoked through the object called Number.
Syntax
In JavaScript, the syntax for the MAX_VALUE property is:
Number.MAX_VALUE;
Parameters or Arguments
There are no parameters or arguments for the MAX_VALUE property.
Returns
The MAX_VALUE property returns the maximum numeric value that can be represented in JavaScript which is 1.7976931348623157e+308.
Note
- The MAX_VALUE property is a property of the Number object and not a number function. However, we have included the MAX_VALUE property within our JS Number Methods section because you will most likely use this property in conjunction with the Number methods found in this section.
Example
Let's take a look at an example of how to use the MAX_VALUE property in JavaScript.
For example:
console.log(Number.MAX_VALUE);
In this example, we have invoked the MAX_VALUE property using the Number class.
We have written the output of the MAX_VALUE property to the web browser console log, for demonstration purposes, to show what the MAX_VALUE property returns.
The following will be output to the web browser console log:
1.7976931348623157e+308
In this example, the MAX_VALUE property returned a value of 1.7976931348623157e+308 which represents the largest numeric value that can be represented in JavaScript.
Advertisements