Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 481055 of Number.MAX_VALUE

  • Revision slug: Web/JavaScript/Reference/Global_Objects/Number/MAX_VALUE
  • Revision title: Number.MAX_VALUE
  • Revision id: 481055
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment

Revision Content

{{JSRef("Global_Objects", "Number")}}

Summary

The maximum numeric value representable in JavaScript.

You do not have to create a {{jsxref("Global_Objects/Number", "Number")}} object to access this static property (use Number.MAX_VALUE).

{{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')}} No change since ES 1st Edition.

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")}}

Revision Source

<div>
  {{JSRef("Global_Objects", "Number")}}</div>
<h2 id="Summary" name="Summary">Summary</h2>
<p>The maximum numeric value representable in JavaScript.</p>
<p>You do not have to create a {{jsxref("Global_Objects/Number", "Number")}} object to access this static property (use <code>Number.MAX_VALUE</code>).</p>
<p>{{js_property_attributes(0,0,0)}}</p>
<h2 id="Description" name="Description">Description</h2>
<p>The <code>MAX_VALUE</code> property has a value of approximately <code>1.79E+308</code>. Values larger than <code>MAX_VALUE</code> are represented as "<code>Infinity</code>".</p>
<p>Because <code>MAX_VALUE</code> is a static property of <code>Number</code>, you always use it as <code>Number.MAX_VALUE</code>, rather than as a property of a <code>Number</code> object you created.</p>
<h2 id="Examples" name="Examples">Examples</h2>
<h3 id="Example:_Using_MAX_VALUE" name="Example:_Using_MAX_VALUE">Example: Using <code>MAX_VALUE</code></h3>
<p>The following code multiplies two numeric values. If the result is less than or equal to <code>MAX_VALUE</code>, the <code>func1</code> function is called; otherwise, the <code>func2</code> function is called.</p>
<pre class="brush: js">
if (num1 * num2 &lt;= Number.MAX_VALUE) {
   func1();
} else {
   func2();
}</pre>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
  <tbody>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
    <tr>
      <td>ECMAScript 1st Edition. Implemented in JavaScript 1.1</td>
      <td>Standard</td>
      <td>Initial definition.</td>
    </tr>
    <tr>
      <td>{{SpecName('ES6', '#sec-number.max_value', 'Number.MAX_VALUE')}}</td>
      <td>{{Spec2('ES6')}}</td>
      <td>No change since ES 1st Edition.</td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<div>
  {{CompatibilityTable}}</div>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari (WebKit)</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>IE Phone</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="See_also" name="See_also">See also</h2>
<ul>
  <li>{{jsxref("Global_Objects/Number/MIN_VALUE", "Number.MIN_VALUE")}}</li>
</ul>
Revert to this revision