Elegant function overloading in JavaScript.