Skip to content

Instantly share code, notes, and snippets.

@dshaw
Created May 1, 2010 05:04
Show Gist options
  • Save dshaw/386064 to your computer and use it in GitHub Desktop.
Save dshaw/386064 to your computer and use it in GitHub Desktop.
The .bind method from Prototype.js
// From @jeresig
// http://ejohn.org/apps/learn/#2
// 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