Skip to content

Instantly share code, notes, and snippets.

@abozhilov
Created August 5, 2011 09:45
Show Gist options
  • Save abozhilov/1127225 to your computer and use it in GitHub Desktop.
Save abozhilov/1127225 to your computer and use it in GitHub Desktop.
Function.prototype.bind
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