Skip to content

Instantly share code, notes, and snippets.

@emartini
Created April 5, 2012 13:05
Show Gist options
  • Save emartini/2310917 to your computer and use it in GitHub Desktop.
Save emartini/2310917 to your computer and use it in GitHub Desktop.
For example, by augmenting Function.prototype, we can make a method available to all functions.
//from Javascript: The Goods Parts
// http://shop.oreilly.com/product/9780596517748.do
Function.prototype.method = function (name, func) {     
this.prototype[name] = func;     
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment