Created
August 5, 2011 09:45
-
-
Save abozhilov/1127225 to your computer and use it in GitHub Desktop.
Function.prototype.bind
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function.prototype.bind = function (thisVal) { | |
var target = this, | |
args = [].slice.call(arguments, 1); | |
function f () { | |
return target.apply( | |
this instanceof f ? this : thisVal, | |
args.concat([].slice.call(arguments)) | |
); | |
}; | |
f.prototype = this.prototype; | |
return f; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment