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

max*_*mus 10 javascript jquery javascript-framework

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

(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);
Run Code Online (Sandbox Code Playgroud)

谁能解释为什么第二个参数未定义

提前致谢!

mas*_*lum 2

Undefined 是一种类型,但也是一个全局变量。

您可以拥有一个通过执行以下操作来覆盖 undefined 值的模块undefined = whatever

jQuery 使用立即函数来确定窗口和未定义的范围。

https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/undefined