{{JSRef}}
The Number.MAX_VALUE
property represents 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 {{jsxref("Number")}}, you always use it as Number.MAX_VALUE
, rather than as a property of a {{jsxref("Number")}} object you created.
Examples
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 |
---|---|---|
{{SpecName('ES1')}} | {{Spec2('ES1')}} | Initial definition. Implemented in JavaScript 1.1. |
{{SpecName('ES5.1', '#sec-15.7.3.2', 'Number.MAX_VALUE')}} | {{Spec2('ES5.1')}} | |
{{SpecName('ES6', '#sec-number.max_value', 'Number.MAX_VALUE')}} | {{Spec2('ES6')}} | |
{{SpecName('ESDraft', '#sec-number.max_value', 'Number.MAX_VALUE')}} | {{Spec2('ESDraft')}} |
Browser compatibility
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
See also
- {{jsxref("Number.MIN_VALUE")}}
- The {{jsxref("Number")}} object it belongs to