Number.NEGATIVE_INFINITY
Holds negative infinity, the value returned when arithmetic overflows below the finite range.
Number.NEGATIVE_INFINITY- Added in JavaScript ES1
Return value
numberNegative infinity — the same value as the global -Infinity. The property is non-writable, non-enumerable and non-configurable.
Errors
Nothing on read; assigning to it throws a TypeError in strict mode, because the property is non-writable.
The IEEE 754 negative infinity, identical to the global expression -Infinity. It appears when a negative value overflows past -Number.MAX_VALUE, when a negative number is divided by zero, and from Math.log(0). It is less than every finite number and less than NaN is comparable to anything at all.
When to reach for it
Its best use is as the starting value for a running maximum. Seeding with 0 is the classic bug — it quietly returns 0 when every input is negative — and seeding with the first element requires an emptiness check. Number.NEGATIVE_INFINITY loses to any real candidate and needs no special case. It is equally the right sentinel for "no lower bound" in a range object.
What trips people up
The same indeterminate forms as positive infinity: -Infinity + Infinity and -Infinity / -Infinity are NaN. Also, dividing a positive number by -Infinity yields negative zero, which prints as 0, compares === 0, and only reveals itself through Object.is() or 1 / x.
And as with its positive twin, JSON.stringify() writes null, so an -Infinity floor does not survive serialization.
Example
When to use it
- Seeding a running maximum so negative-only data still produces the right answer.
- Representing an open lower bound in a range or filter object.
- Recognising underflow past -Number.MAX_VALUE, or a log of zero, in numeric code.
Frequently asked questions
What is the difference between -Infinity and Number.NEGATIVE_INFINITY?
None — they are the same value and compare equal. Number.NEGATIVE_INFINITY is a static property, so it cannot be broken by a local variable shadowing the global Infinity binding.
What should I initialise a maximum to in JavaScript?
Number.NEGATIVE_INFINITY, because every real number beats it. Starting at 0 returns 0 for all-negative data, and starting at the first element needs an extra check for an empty array.
Why does dividing by -Infinity give me 0?
It gives negative zero (-0), which console.log prints as 0 and which passes === 0. Distinguish it with Object.is(x, -0), or by checking whether 1 / x is -Infinity.
More examples
Why 0 is the wrong seed for a maximum
With an all-negative dataset the zero seed never loses a comparison, so the function reports a maximum of 0 — a number that appears nowhere in the input. Seeding with NEGATIVE_INFINITY gives -2, matching Math.max() directly.
const deltas = [-4, -9, -2];
let withZero = 0;
for (const d of deltas) withZero = Math.max(withZero, d);
let withNegInf = Number.NEGATIVE_INFINITY;
for (const d of deltas) withNegInf = Math.max(withNegInf, d);
console.log(withZero); // 0 - a value that is not in the data
console.log(withNegInf); // -2 - the actual maximum
console.log(Math.max(...deltas)); // -2Math.max() with no arguments, and the -0 trap
Math.max() returns -Infinity for an empty argument list, since -Infinity is the identity for maximum — so spreading an empty array gives -Infinity rather than an error. The second half shows negative zero: it logs as 0 and passes === 0, and only Object.is() or taking its reciprocal exposes the sign.
console.log(Math.max()); // -Infinity
console.log(Math.max(...[])); // -Infinity
const x = 5 / Number.NEGATIVE_INFINITY;
console.log(x); // 0
console.log(x === 0); // true
console.log(Object.is(x, -0)); // true
console.log(1 / x); // -Infinity
Discussion