In a side project that I’ve been working on I built a quick-and-dirty function for doing simple method overloading. For those of you who aren’t familiar with, it’s just a way of mapping a single function call to multiple functions based upon the arguments they accept. Here’s the function in question: // addMethod - By John Resig (MIT Licensed) function addMethod(object, name, fn){ var old = object