Number.MAX_VALUE
Resum
La propietat Number.MAX_VALUE
representa el valor numèric màxim representable en JavaScript.
Property attributes of Number.MAX_VALUE |
|
---|---|
Writable | no |
Enumerable | no |
Configurable | no |
Descripció
La propietat MAX_VALUE
té un valor aproximadament de 1.79E+308
. Els valors més grans que MAX_VALUE
són representats com a "Infinity
".
Ja que MAX_VALUE
és una propietat estàtica de Number
, sempre es fa servir com a Number.MAX_VALUE
, en comptes d'una propietat de l'objecte Number
que s'ha creat.
Exemples
Exemple: Fer servir MAX_VALUE
El codi següent multiplica dos valors numèrics. Si el resultat és menor o igual a MAX_VALUE
, es crida la funció func1
; del contrari, es crida la funció func2
.
if (num1 * num2 <= Number.MAX_VALUE) {
func1();
} else {
func2();
}
Especificacions
Especificació | Estat | Comentaris |
---|---|---|
1a edició de ECMAScript. | Estàndard | Definició inicial. Implementat en JavaScript 1.1. |
ECMAScript 5.1 (ECMA-262) The definition of 'Number.MAX_VALUE' in that specification. |
Standard | |
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Number.MAX_VALUE' in that specification. |
Standard |
Compatibilitat amb navegadors
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help! (en-US)
Característica | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Suport bàsic | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
Característica | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Supor bàsic | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |