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: Value 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]

JS Number

  1. Format Number
  2. String to Number
  3. Random Number

Like it? Help me by telling your friends. Or, Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials