Function.prototype.bind=function(obj){
var _method = this;
return function(){
_method.apply(obj,arguments);
}
}
call和apply差不多,只是call参数是一个个arg,而apply是arguments.
The difference is that bind
returns a function reference that can be used later, rather than the result of an immediate execution that we get with call
.