title: Find all classes in a Javascript application that extend a base class
body: <p>I have code like this</p>
  <pre class="lang-js prettyprint-override"><code>class Animal{}
  class Dog extends Animal {}
  class Cat extends Animal {}
  class Donkey extends Animal {}
  </code></pre>
  <p>I want to look at all of the classes in my application's universe, and when I find one that descends from Animal, I want to create a new object of that type and add it to the list. This allows me to add functionality without having to update a list of things. So I can avoid the following:</p>
  <pre class="lang-js prettyprint-override"><code>var animals = [];
  animals.push( new Dog() );
  animals.push( new Cat() );
  animals.push( new Donkey() );
  </code></pre>
  <p>PS: I don't want to add extra functionality to my classes or call them explicitly.</p>