[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Infinity [Back]  [Original]

Infinity - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

Infinity

20157

Infinity

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

Number.POSITIVE_INFINITY

Infinity

Infinity global object

Infinity Number.POSITIVE_INFINITYInfinity

Number.POSITIVE_INFINITY

js
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