源自:6-4 [JavaScript]函数属性arguments
想参照老师的代码打一下,看看arugments,结果提示SyntaxError: Unexpected token this,跪求解决
function foo(){
this.b=100;
retrun this.a;
}
var func=foo.binddd({a:1});
Function.prototype.binddd=function(oThis){
var aArgs=Array.prototype.slice.call(arguments,1);
fToBind=this;
fNOP=function(){};
Bound=function(){
return fToBind.apply(this instanceof fNOP?this:oThis,aArgs.concat(Array.prototype.slice.call(arguments)));
}
fNOP.prototype=this.prototype;
fBound.prototype=new fNOP();
return fBound;
};
func();
new func();
提问者:风魔大王
2016-11-29 10:59