Javascript Reference - JavaScript MAX_VALUE Property








The MAX_VALUE property returns the largest number possible in JavaScript.

This static property has a value of 1.7976931348623157e+308.

MAX_VALUE is a static property of the JavaScript Number object. We can only use it as Number.MAX_VALUE.

Browser Support

MAX_VALUE Yes Yes Yes Yes Yes

Syntax

Number.MAX_VALUE

Return Value

A Number, 1.7976931348623157e+308





Example


<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {<!--  www. j a  va  2  s.co  m-->
    var x = 100; 
    document.getElementById("demo").innerHTML = x.MAX_VALUE;
}
</script>

</body>
</html>

The code above is rendered as follows:





Example 2

The following code shows how to return the largest number possible in JavaScript.


<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {<!--from w  ww .  j ava  2s . c  o m-->
    document.getElementById("demo").innerHTML = Number.MAX_VALUE;
}
</script>
</body>
</html>

The code above is rendered as follows: