在jQuery核心源代码中传递未定义的参数 [英] Passed in undefined argument in jQuery core source code

查看:61
本文介绍了在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.

这篇关于在jQuery核心源代码中传递未定义的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆