JavaScript: 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 JavaScript: 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 JavaScript: Number.isFinite

Number Topic


  1. JavaScript: Number Object
  2. JavaScript: Number Constructor
  3. JavaScript: Number.prototype
Like what you read? Buy JavaScript in Depth
or, buy a new keyboard, see Keyboard Reviews.