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 );

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 );

Type of Infinity is number.

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

Infinity === Infinity return true.

console.log( Infinity === Infinity );

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