JS: Infinity

By Xah Lee. Date: .

Infinity is a builtin value.

Infinity is typically returned when divide by zero.

console.log ( 1/0 === Infinity ); // true

Type of Infinity is "number".

〔►see JS: Data Types

console.log ( typeof Infinity === "number" ); // true

Infinity === Infinity returns true.

console.log ( Infinity === Infinity ); // true

Test Infinity

To test if a value is finite, use Number.isFinite.

〔►see JS: Number.isFinite

Number Topic

  1. JS: Number Object
  2. JS: Number Constructor
  3. JS: Number.prototype
Like what you read? Buy JavaScript in Depth