| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Infinity | [Back] [Original] |
Get to know MDN better
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
Infinity | |
|---|---|
Infinity global object
Infinity Number.POSITIVE_INFINITYInfinity
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 */
| ECMAScript 2027 LanguageSpecification # sec-value-properties-of-the-global-object-infinity |
| Web Proxy Viewer | New URL | Original Page |