title: Cannot assign this. variables in object prototypes
body: <p>I'm currently studying javascript prototypes and I'm quite confused on how it really works. I have this code snippet and it works perfectly</p>
  
  <pre><code>function Message(msg){
      this.msg =msg;
  }
  
  Message.prototype = {
  
      constructor:Message,
      display: function(){
           return this.msg;
      }
  
  };
  
  
  alert(new Message("007").display());
  </code></pre>
  
  <p>What this code is trying to do is to illustrate a simple encapsulation by using javascript.</p>
  
  <p>Now the problem is, I want to add this <strong>text:this.msg</strong> instead of using the display method</p>
  
  <pre><code>Message.prototype = {
  
      constructor:Message,
      someValue:99,
      text: this.msg,
      display: function(){
           return this.msg;
      }
  
  };
  </code></pre>
  
  <p>But i only get undefined when i call</p>
  
  <pre><code> alert(new Message("007").text);
  </code></pre>
  
  <p>But calling</p>
  
  <pre><code>alert(new Message("007").someValue);
  </code></pre>
  
  <p>Displays 99. What is the problem here?</p>