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 678893 of Number.MAX_VALUE

  • Revision slug: Web/JavaScript/Reference/Global_Objects/Number/MAX_VALUE
  • Revision title: Number.MAX_VALUE
  • Revision id: 678893
  • Created:
  • Creator: Mingun
  • Is current revision? No
  • Comment Standartized markup, added jsxref templates, indent to 2 spaces.

Revision Content

{{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 {{jsxref("Global_Objects/Number", "Number")}}, you always use it as Number.MAX_VALUE, rather than as a property of a {{jsxref("Global_Objects/Number", "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. Standard 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')}}  

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

Revision Source

<div>{{JSRef("Global_Objects", "Number")}}</div>

<h2 id="Summary" name="Summary">Summary</h2>
<p>The <strong><code>Number.MAX_VALUE</code></strong> property represents the maximum numeric value representable in JavaScript.</p>

<div>{{js_property_attributes(0, 0, 0)}}</div>

<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 {{jsxref("Global_Objects/Number", "Number")}}, you always use it as <code>Number.MAX_VALUE</code>, rather than as a property of a {{jsxref("Global_Objects/Number", "Number")}} 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.</td>
   <td>Standard</td>
   <td>Initial definition. Implemented in JavaScript 1.1.</td>
  </tr>
  <tr>
   <td>{{SpecName('ES5.1', '#sec-15.7.3.2', 'Number.MAX_VALUE')}}</td>
   <td>{{Spec2('ES5.1')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('ES6', '#sec-number.max_value', 'Number.MAX_VALUE')}}</td>
   <td>{{Spec2('ES6')}}</td>
   <td> </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</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>Chrome for Android</th>
    <th>Firefox Mobile (Gecko)</th>
    <th>IE Mobile</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>
    <td>{{CompatVersionUnknown}}</td>
   </tr>
  </tbody>
 </table>
</div>

<h2 id="See_also" name="See_also">See also</h2>
<ul>
 <li>{{jsxref("Number.MIN_VALUE")}}</li>
</ul>
Revert to this revision