function f1(){ var n =10; nadd = function(){n += 1} function f2(){ alert(n); } return f2; } var result = f1(); //f2的闭包函数 //result(); //nadd(); //result(); var name = "The Window"; var object = { name : "My Object", getNameFunc : function(){ var that = this; return function(){ // return that.name; }; } }; // alert(object.getNameFunc()());
;