title: Storing object type in javascript
body: <p>I am trying to store object type in to variable instead of creating actual object. Based on the type, I would like to create object when ever I needed.</p>
  
  <p>I've tried the below method to get the type </p>
  
  <pre><code>function getType(obj){
          var text = Function.prototype.toString.call(obj.constructor);
          return text.match(/function (.*)\(/)[1];
  }
  </code></pre>
  
  <p>But issue with above method, it calls constructor to the get the type name.</p>
  
  <p>I don't want to initialize the object until i actually needed.</p>
  
  <p>Any thoughts.</p>
  
  <p>Thanks
  Naren</p>