Skip to content

Instantly share code, notes, and snippets.

@lushijie
Created July 15, 2019 11:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lushijie/b3816858a197c2cfe1e3f1f5e5ef01b2 to your computer and use it in GitHub Desktop.
Save lushijie/b3816858a197c2cfe1e3f1f5e5ef01b2 to your computer and use it in GitHub Desktop.
bind2
Function.prototype.bind2 = function(context) {
const self = this;
const args = Array.prototype.slice.call(arguments, 1);
return function() {
const args2 = Array.prototype.slice.call(arguments);
self.apply(context, args.concat(args2));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment