Infinity
as used in your example is not actually a value but refers to the Infinity
property of the global object:
15.1 The Global Object
[...]
15.1.1 Value Properties of the Global Object
[...]
15.1.1.2 Infinity
The value ofInfinity
is+∞
(see 8.5). This property has the attributes { [[Writable]]:false
, [[Enumerable]]:false
, [[Configurable]]:false
}.
So, Infinity--
is the same as window.Infinity--
which is perfectly valid.