- Function.prototype.bind = Function.prototype.bind || function(thisarg){
- var that = this,
- args = [],
- i;
- for(i=1; i<arguments.length; i++)
- args.push(arguments[i]);
- function F() {
- var args2 = [].concat(args);
- for(i=0; i<arguments.length; i++)
- args2.push(arguments[i]);
- that.apply(thisarg, args2);
- }
- return F;
- };
- //该片段来自于http://www.codesnippet.cn/detail/2003201511924.html
来源: http://www.codesnippet.cn/detail/2003201511924.html