【发布时间】:2012-02-22 23:45:33
【问题描述】:
可能重复:
What do parentheses surrounding a JavaScript object/function/class declaration mean?
What does this javascript syntax mean?
What does this “(function(){});”, a function inside brackets, mean in javascript?
在下面的代码中,匿名函数正在执行。
var a= 1;
var b =2;
(function() {
var b = 3;
a += b;
})();
document.write(a + " "+ b);
1) 在函数定义周围加上括号有什么作用?
2) 在右括号后面加上() 有什么作用?
【问题讨论】:
-
阅读本文:stackoverflow.com/questions/593509/… 希望对您有所帮助 :)
标签: javascript