Skip to content

Instantly share code, notes, and snippets.

@mmazer
Created September 24, 2012 01:31
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 mmazer/3773735 to your computer and use it in GitHub Desktop.
Save mmazer/3773735 to your computer and use it in GitHub Desktop.
JavaScript: Prototype bind
// The .bind method from Prototype.js
Function.prototype.bind = function(){
var fn = this, args = Array.prototype.slice.call(arguments), object = args.shift();
return function(){
return fn.apply(object,
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