title: Changing constructor in JavaScript
body: <p>I am trying for a while to switch constructor for a object and I am failing. Continuing code will show example of what I need. Thanks.</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
  
      function Me(){
  
        this.name = "Dejan";
      }
  
      function You(){
  
          this.name = "Ivan";
      }
  
  
      Me.prototype.constructor = You;
      somebody = new Me();
  
  
      alert(somebody.name); // **It gives Dejan, and I am expecting Ivan**
  
      &lt;/script&gt;
  </code></pre>