【发布时间】:2011-07-06 14:35:10
【问题描述】:
可能的重复:
How does this JavaScript/JQuery Syntax work: (function( window, undefined ) { })(window)?
What advantages does using (function(window, document, undefined) { … })(window, document) confer?
我看到很多 javascript 库创建了一个名为“undefined”的变量,我无法弄清楚它的用途,下面是从 jQuery 库复制的行
* Date: Wed Feb 23 13:55:29 2011 -0500
*/
(function( window, undefined ) {
// Use the correct document accordingly with window argument (sandbox)
var document = window.document;
var jQuery = (function() {
请告诉我这样做的原因和好处!!
【问题讨论】:
标签: javascript jquery