I keep seeing in OSS source code functions that have undefined
as parameter, e.g. like this from fancybox:
(function (window, document, $, undefined) {
"use strict";
// snip-snip
}(window, document, jQuery));
;(function(defaults, $, undefined) {
// snip, snip
})({
// snip, snip settings
}, jQuery);
Is there some reason why?
EDIT: Okay, so I get it that it gets defined undefined locally but I have an issue with this, checking something is undefined
won't work sometimes:
if (thing === undefined) {}
// will crash if thing has never been initialized
if (typeof thing === 'undefined') {}
// always works
Is there some performance gain to this or something?