The Number.NEGATIVE_INFINITY property represents the negative Infinity value. Any value that goes over the maximum value is available in JavaScript gets changed to negative infinity.
Example
function checkInfinity(smallNumber) { if (smallNumber === Number.NEGATIVE_INFINITY) { return 'Process number as -Infinity'; } return smallNumber; } console.log(checkInfinity(-Number.MAX_VALUE)); console.log(checkInfinity(-Number.MAX_VALUE * 2));
Output
-1.7976931348623157e+308 "Process number as -Infinity"
You can find more details about how this number is processed in javascript at MDN docs:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY
Note − The value of Number.NEGATIVE_INFINITY is the same as the negative value of the global object's Infinity property.