{{JSRef("Global_Objects", "Number")}}
Summary
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 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('ES5.1', '#sec-15.7.3.2', 'Number.MAX_VALUE')}} | {{Spec2('ES5.1')}} | |
{{SpecName('ES6', '#sec-number.max_value', 'Number.MAX_VALUE')}} | {{Spec2('ES6')}} |
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")}}