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 return 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
Liket it? Put $1 at patreon.

Or, Buy JavaScript in Depth