JavaScript: Infinity
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 .