我会尽量清楚我的问题,所以:
有很多博客和教程解释了闭包,但我没有弄清楚创建闭包的上下文的其他属性会发生什么?jsFiddle
function func(){
this.context_field = "context_field";
this.context_method = function(){
console.log("context method");
};
func = function(param, change){
if(typeof(change) === 'undefined'){
//......
console.log(param + " " + context_field + " from original func - closure\n\n");
//.....
}
return func;
};
func()("Init finished and call");
func("Call again", "");