Skip to content

Instantly share code, notes, and snippets.

@ahonn
Last active September 25, 2019 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahonn/8cc7f6cd7811138933f470adf1c9b14f to your computer and use it in GitHub Desktop.
Save ahonn/8cc7f6cd7811138933f470adf1c9b14f to your computer and use it in GitHub Desktop.
Function.prototype.bind = function (ctx) {
var self = this;
var nativeSlice = Array.prototype.slice;
var args = nativeSlice.call(arguments, 1);
return function () {
var bindArgs = args.concat(nativeSlice.call(arguments));
return self.apply(ctx, bindArgs);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment