为什么需要在同一行上调用匿名函数?
// Create a new anonymous function, to use as a wrapper(function(){
// The variable that would, normally, be global
var msg = "Thanks for visiting!";
// Binding a new function to a global object
window.onunload = function(){
// Which uses the 'hidden' variable
alert( msg );
};// Close off the anonymous function and execute it})();(function (msg){alert(msg)})('SO');(function (msg){alert(msg)})(function (msg){alert(msg)});('SO');慕莱坞森
相关分类