在jQuery核心源代码中传递未定义的参数

问题描述:

我注意到在jQuery核心中,传入的两个参数之一是未定义的。

I noticed that in the jQuery core, one of the two arguments passed in is undefined.

(function( window, undefined ) {

    // Use the correct document accordingly with window argument (sandbox)
    var document = window.document;
    var jQuery = (function() {
        // ...defintion of the rest of the core...
    window.jQuery = window.$ = jQuery;
})(window);

任何人都可以解释为什么第二个参数是 undefined

Can anyone explain why the second argument is undefined?

提前致谢!

因为有人可以像这样覆盖未定义

Since someone could overwrite undefined like this

undefined = true;

你的直接函数的代码将按原样传递(保持未定义)。我认为它在我从jQuery Source中学到的10件事

Code of your immediate function will pass it as it should be (stay undefined). I think it's mentioned in 10 Things I Learned from the jQuery Source.