JavaScript: Infinity

By Xah Lee. Date: . Last updated: .

Infinity is the value of the property key "Infinity" of the Global Object.

console.log( window["Infinity" ] === Infinity ); // true

Infinity is a literal value. For example, you can write let x = Infinity;

Infinity is typically returned when divide by zero.

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

Type of Infinity is number.

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 .

JavaScript Special Literals

JavaScript in Depth

JS Obj Reference

Global Object

Special Objects

Static Objects

Primitive Wrapper

Constant Literals

Simple Functions

Error Objects