In JavaScript, Infinity and -Infinity are special values that represent positive infinity and negative infinity, respectively. These values are used to represent numbers that are too large (or too small) to be represented as regular numbers.
Negative infinity (-Infinity) is a value that is less than any other number, including negative numbers. It is the result of dividing a negative number by zero, or subtracting Infinity from a negative number. For example:
1 2 | console.log(-1 / 0); // outputs -Infinity console.log(-100 - Infinity); // outputs -Infinity |
1 2 3 | console.log(-10 < -Infinity); // outputs true console.log(-Infinity < 0); // outputs true console.log(-Infinity > Infinity); // outputs false |