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 .

∑ JS in Depth
XAH  BUY NOW

JS in Depth

JS Obj Ref

DOM


JS Obj Ref

Static Objects

Primitive Wrapper

Special Objects