{{JSRef("Global_Objects", "Number")}}
Summary
The maximum numeric value representable in JavaScript.
{{js_property_attributes(0,0,0)}}
Description
The MAX_VALUE
property has a value of approximately 1.79E+308
. Values larger than MAX_VALUE
are represented as "Infinity
".
Because MAX_VALUE
is a static property of Number
, you always use it as Number.MAX_VALUE
, rather than as a property of a Number
object you created.
Examples
Example: Using MAX_VALUE
The following code multiplies two numeric values. If the result is less than or equal to MAX_VALUE
, the func1
function is called; otherwise, the func2
function is called.
if (num1 * num2 <= Number.MAX_VALUE) { func1(); } else { func2(); }
Specifications
Specification | Status | Comment |
---|---|---|
ECMAScript 1st Edition. Implemented in JavaScript 1.1 | Standard | Initial definition. |
{{SpecName('ES6', '#sec-number.max_value', 'Number.MAX_VALUE')}} | {{Spec2('ES6')}} | Latest definition. |
Browser compatibility
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
See also
- {{jsxref("Global_Objects/Number/MIN_VALUE", "Number.MIN_VALUE")}}