Infinity
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
La propriété globale Infinity est une valeur numérique représentant l'infini.
Attributs de Infinity | |
|---|---|
| Écrivable | Non |
| Énumérable | Non |
| Configurable | Non |
Exemple interactif
Syntaxe
Infinity;
Description
Infinity est une propriété de l'objet global , c'est-à-dire qu'elle est accessible globalement.
La valeur initiale d'Infinity est Number.POSITIVE_INFINITY. La valeur Infinity (infinité positive) est une valeur plus grande que n'importe quel nombre. Cette valeur se comporte comme l'infini mathématique ; par exemple, tout ce qui est multiplié par Infinity vaut Infinity, et tout ce qui est divisé par Infinity vaut 0.
D'après la spécification ECMAScript 5, Infinity est en lecture seule.
Exemples
console.log(Infinity); // Infinity
console.log(Infinity + 1); // Infinity
console.log(Math.pow(10, 1000)); // Infinity
console.log(Math.log(0)); // -Infinity
console.log(1 / Infinity); // 0
Spécifications
| Specification |
|---|
| ECMAScript® 2025 Language Specification # sec-value-properties-of-the-global-object-infinity |
Compatibilité des navigateurs
BCD tables only load in the browser