Created
February 12, 2017 07:56
-
-
Save amalantony/fad5af88f8bc76fcd03439cd520221a7 to your computer and use it in GitHub Desktop.
Function.prototype.bind implementation.
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() { | |
var args = Array.prototype.slice.call(arguments); | |
var context = args.shift(); | |
var fn = this; | |
return function() { | |
fn.apply(context, args.concat(Array.prototype.slice.call(arguments))) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment