title: Is it possible to have a javascript constructor return different object types?
body: <p>I would like to do something like this:</p>
  
  <pre><code>function AjaxRequest (parameters) {
      if (window.XMLHttpRequest) {
          this = new XMLHttpRequest();
      else if (typeof ActiveXOBject != 'undefined')
          this = new ActiveXObject("Microsoft.XMLHTTP");
  }
  
  AjaxRequest.prototype.someMethod = function () { ... }
  </code></pre>
  
  <p>Is there a way to do this?</p>