【发布时间】:2014-09-12 14:33:49
【问题描述】:
抱歉,因为我是 javascript 新手,所以我不够清楚。
让我用一个例子来解释一下。
例如,如果我有
*
(function()
var foo;
windows.foo = foo = (function()){
function foo (a,b){
this.colour = a.colour
this.shape = b.shape
}
return foo;
})();
}).call(this);*
现在我的问题是
- 关于范围,当“foo”是全局和本地时。
2.如何在 HTML 中显示 foo 的值。我不能使用 document.getElementbyid();有没有其他功能可以使用??????
【问题讨论】:
-
应该是
getElementById,而不是getelementbyid。 -
here the second asdf is a class and the fist asdf is a global variable.错误,在这两点上。// why Parenthesis "()";研究 IIFE。// what does it mean and its significance?取决于this是什么以及它正在执行什么(你忽略了它)。问题二没有任何意义。 -
阅读stackoverflow.com/questions/16937022/…。请注意,内部 IIFE 完全没有意义。
-
暂停直到......你这个笨蛋妈妈 fcÄkers
标签: javascript jquery html