Infinity
is a global property of the global
object. It is a number that exceeds any other number. It is read-only, meaning you cannot modify it. We will try to modify it in one of the examples below. Infinity can be negative or positive, as we know in mathematics.
console.log(Infinity)console.log(Math.pow(10, 1000)) // Positive infinity
// create negative and positive infinity valueslet negInfinity = -1.797693134862315E+308let posInfinity = +1.797693134862315E+308// log to the consoleconsole.log(negInfinity)console.log(posInfinity)
console.log(Number.POSITIVE_INFINITY)