如何理解 JavaScript 中作为参数的函数的作用域和 this?
一个例子来自于Douglas的书:
Function.prototype.method = function ( name,func ) {
this.prototype[name] = func;
return this;
};
Function.method('curry',function () {
//此函数作用域是什么呢
//此处this指什么呢?
});
如果定义:
var a = function (){
alert(this);
};
Function.method('curry',a);
此时的this是window吗?
谢谢各位前辈指教。