There are two reasons for that:
- Since undefined is a property of the global object, without write-protection, it can be overridden which may result in strange and unexpected behavior when trying this: ( var == undefined).
By having an function argument undefined (the name actually does not matter) which you don't pass a parameter to, you make sure you have a variable which really is undefined so you can test "undefinedness" against this variable.
Btw. the safest method to test for undefined is: typeof ( var ) === 'undefined'
EDIT: With adoption of EcmaScript 5, undefined, NaN and Infinity are now readonly in all modern browsers - of course with the exception of Internet Explorer up to Version 9 :(. So this is not necessary anymore, however:
- Since undefined is now a variable name in this function's scope rather than a global object property, minifiers can reduce it to a single letter thus achieving a better compression rate on the minified file.
http://stackoverflow.com/questions/9602901/what-is-the-purpose-of-passing-in-undefined