javascript - Arguments of self executing function -
this question has answer here:
(function (global, undefined) { ... code doesnt use arguments array } (this));
i see module pattern done in way.
i question why there's second argument undefined
? these examples buggy or there special meaning of undefined
here?
undefined
global property used. in older versions of javascript possible change value of (for example, true
). breaks everything. changing scope local "module" (i.e. function), other modules prevented interfering it.
this allows code safely use undefined
instead of having use global.undefined
.
Comments
Post a Comment