Skip to content

Instantly share code, notes, and snippets.

@icodeforlove
Created January 11, 2012 22:43
Show Gist options
  • Save icodeforlove/1597229 to your computer and use it in GitHub Desktop.
Save icodeforlove/1597229 to your computer and use it in GitHub Desktop.
bind
/**
* Copyright (c) Mozilla Foundation http://www.mozilla.org/
* This code is available under the terms of the MIT License
*/
if (!('bind' in Function.prototype)) {
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