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.
MAX_VALUE |
Yes | Yes | Yes | Yes | Yes |
Number.MAX_VALUE
A Number, 1.7976931348623157e+308
<!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:
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: