title: Problem when trying to instantiate a class dynamically
body: <p>I am trying to instantiate classes _0, _1, and _2 dynamically.</p>
  <p>But in the <code>DynamicClass</code> class where I am trying to do this throws an error and I am not clear on how to solve it.</p>
  <p>If I carry out the process in a static way, it is as follows:</p>
  <p>return new _1 (). getProperty ()</p>
  <p>I get the correct result,</p>
  <p>but I need to do it dynamically</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>abstract class Auto {
    abstract getProperty();
  }
  
  class _0 extends Auto {
    getProperty() {
      return 400;
    }
  }
  class _1 extends Auto {
    getProperty() {
      return 2000;
    }
  }
  class _2 extends Auto {
    getProperty() {
      return 100;
    }
  }
  
  class DynamicClass {
    select() {
      let random: any = "_" + Math.floor(Math.random() * 3);
      console.log(random);
      return new random().getProperty();
    }
  }
  
  console.log(new DynamicClass().select());</code></pre>
  </div>
  </div>
  </p>