MAX_VALUE (JavaScript)
Largest positive finite value of a number.
Defined in
Number (Standard - JavaScript)Syntax
Number.MAX_VALUE
Usage
MAX_VALUE is a constant and has the same value whether called statically as shown in the syntax or from an object.MAX_VALUE is approximately 1.7976931348623157E308.
A number greater than MAX_VALUE has the value POSITIVE_INFINITY.
Examples
This example prints MAX_VALUE then demonstrates that a very large number is greater than MAX_VALUE.function p(stuff) {
print("<<<" + stuff + ">>>");
}
try {
p(Number.MAX_VALUE.toPrecision(16));
// prints <<<1.7976931348623157E308>>>
var n = new Number(1.7976931348623157E309);
if (n > Number.MAX_VALUE) {
p(n + " > Number.MAX_VALUE");
// prints <<<Infinity > Number.MAX_VALUE>>>
}
} catch(e) {
p("Error = " + e);
}