JS: Infinity

By Xah Lee. Date: . Last updated: .

What is Infinity

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

window["Infinity" ] === Infinity

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

Purpose of Infinity

Infinity is typically returned when divide by zero.

1/0 === Infinity

Type of Infinity

Type of Infinity is number.

typeof Infinity === "number"

Infinity === Infinity return true.

Infinity === Infinity

Test Infinity

JavaScript, Special Literals

BUY ΣJS JavaScript in Depth