Function.prototype.myBind = function(context){ if(typeof this !== 'function'){ throw ner Error('...') } var self = this var args = Array.prototype.slice.call(arguments, 1) var fNull = function(){} var fBind = function(){ var bindArgs = Array.prototype.slice.call(arguments) return self.apply(this instanceof fBind ? this : context, args.concat(bindArgs)) } fBind.prototype = this.prototype fBind.prototype = new fNull() return fBind }