When a function is called with fewer arguments than its signature contains, the return arguments are set to undefined .
Thus, the above is a roundabout way to get the value undefined , even if some crazy person overrides it by saying var undefined= 'hello'; . (In any case, this is illegal in ECMAScript Fifth Edition strict mode, but JavaScript encoders sometimes do some weird things.)
Actually there is no good reason for going into a window like this, though ... the traditional way to get a window , if you cannot rely on window , is to call the function directly and use this .
In any case, this is just defensive coding against the author's pathological JavaScript. This is not something you should worry about when you write your own code (in any case, you cannot stop anything that can ruin their JS environment in any way), and it is not chain-related.
source share