English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Attributs globaux JavaScript/Fonction
GlobalInfinityThe property is a numerical value representing infinity.
Infinity represents the numerical value of positive infinity.
-Infinity represents the numerical value of negative infinity.
When the number exceeds the upper limit of floating-point numbers (that is1.797693134862315E + 308)it will display Infinity.
When the number exceeds the lower limit of floating-point numbers, that is-1.797693134862316E + 308When, it will display-Infinity.
The initial value of Infinity isNumber.POSITIVE_INFINITY.
Infinity
var x = document.getElementById('result'); x.innerHTML = Infinity; // Infinity x.innerHTML = Math.pow(10, 1000); // Infinity x.innerHTML = 1.7976931348623157E+10308; // Infinity x.innerHTML = -1.7976931348623157E+10308; // Negative InfinityVérifiez et voyez‹/›
Tous les navigateurs prennent en charge intégralement la propriété Infinity :
Propriété | |||||
Infinity | Oui | Oui | Oui | Oui | Oui |
Écrivable : | Non |
---|---|
Enumérable : | Non |
Configurable : | Non |
Version JavaScript : | ECMAScript 1 |
Vérifiez si maxNumber est infini :
var maxNumber = Math.pow(10, 1000); // Nombre maximum if (maxNumber === Infinity) { document.getElementById('result').innerHTML = "Nous le nommons infini!"; }Vérifiez et voyez‹/›