bind方法的内部实现代码
Function.prototype.myBind = function (target) { var self = this; var args = [].slice.call(arguments, 1); var temp = function () {}; var f = function () { var _arg = [].slice.call(arguments, 0); return self.apply( this instanceof temp ? this : (target || window), args.concat(_arg)); } temp.prototype = self.prototype; f.prototype = new temp(); return f; }