Working with a dynamic and complete language like Ruby, I feel the lack of many native methods. Lately, I’m working-by-plugin implementing new code, and injecting it into the old one from Rails or Prototype, and so on.. It’s a very nice and grateful way of add and remove features on the fly, and change the aspect of the code. In fact this kind of tecniques and programming paradigms are also called AOP, due to the capability to change the aspect of an object, and, of course, its behaviors. For this purpose, I feel very useful the Ruby alias_method. Of course, it’s a way to create an alias, and eventually override that method, and reuse the brand new name into the old one!! So playing around a bit with Javascript, I have add this feature to the Object class:
Object.aliasMethod = function(object, newMethodName, oldMethodName) { object[newMethodName] = object[oldMethodName]; };

Here a little example: String.prototype = Object.extend(String.prototype, { capitalize: function() { return ‘The capitalized version of ‘+this+’ is: ‘+this.aliasedCapitalizeMethod()+’.’; } });

alert('fOO'.capitalize());
// -> The capitalized version of fOO is; Foo.

UPDATE I submitted a patch to the Prototype community and I noticed that the improve to the AOP, was already added into the 1.6.0-rc, by the method wrap. For a complete reference, visit the Sam Stephenson post.