Just so there is no misunderstanding, this question is not about allowing for optional parameters in a JS function.

My question is motiviated by the jQuery parseXML function, which is defined in jQuery.js as follows:

// Cross-browser xml parsing
// (xml & tmp used internally)
parseXML: function( data, xml, tmp ) { 
   ... 
} 

Within the body of the function, the parameters xml and and tmp are both assigned before they are used. That means they are being used as local variables, so the function could have been defined like this:

parseXML: function(data) { 
   var xml, tmp;
   ... 
}

What is the benefit of doing it the first way, other than saving a few characters in the minified version of jQuery.js?

Edit
Report