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.
Die Infinity
globale Eigenschaft ist ein numerischer Wert, der die Unendlichkeit darstellt.
Probieren Sie es aus
const maxNumber = Math.pow(10, 1000); // Max positive number
if (maxNumber === Infinity) {
console.log("Let's call it Infinity!");
// Expected output: "Let's call it Infinity!"
}
console.log(1 / maxNumber);
// Expected output: 0
Wert
Der gleiche Zahlenwert wie Number.POSITIVE_INFINITY
.
Eigenschaften von Infinity | |
---|---|
Schreibbar | nein |
Aufzählbar | nein |
Konfigurierbar | nein |
Beschreibung
Infinity
ist eine Eigenschaft des globalen Objekts. Mit anderen Worten, es ist eine Variable im globalen Geltungsbereich.
Der Wert Infinity
(positive Unendlichkeit) ist größer als jede andere Zahl.
Dieser Wert verhält sich geringfügig anders als die mathematische Unendlichkeit; siehe Number.POSITIVE_INFINITY
für Details.
Beispiele
Verwendung von Infinity
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 */
console.log(1 / 0); /* Infinity */
Spezifikationen
Specification |
---|
ECMAScript® 2025 Language Specification # sec-value-properties-of-the-global-object-infinity |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Infinity |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support