The property Infinity
represents the numeric value of infinity.
const number = Infinity;
let number = Infinity;
console.log(number); // Prints: Infinity
let number2 = -Infinity;
console.log(number2); // Prints: -Infinity
console.log(1/Infinity); // Prints: 0
console.log(Infinity - Infinity); // Prints: NaN
console.log(Infinity + Infinity); // Prints: Infinity
Infinity is a global object which represents infinity. There are two types of infinity positive and negative.