Metaprogramming in JavaScript

Wikipedia defines Metaprogramming as:

Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually, or it gives programs greater flexibility to efficiently handle new situations without recompilation.

As it happens, JavaScript has great facilities for metaprogramming through its prototypal inheritance. Here is an example which shows how much easier metaprogramming is in JS than in Ruby.