title: Why declare properties on the prototype for instance variables in JavaScript
body: <p>I'm trying to get my head around this black art called JavaScript - and, I must admit, pretty excited about it. I've been looking at code examples, mainly from "easeljs" since that is what I will be using mainly. And I'm a bit confused..</p>
  
  <p>I (think I) understand the difference between using the <code>prototype</code> for functions or properties that are <code>class</code> variables and using <code>this.someProp</code> for 'instance' variables (Yes, I understand that there are no classes in JavaScript.) </p>
  
  <p>The code I have looked at, and am using as templates for my own code, <code>declare</code> <code>prototype</code> variables and then refers to them with this i.e.</p>
  
  <p>In the constructor: </p>
  
  <pre><code>this.name = name;
  </code></pre>
  
  <p>Then a declaration: </p>
  
  <pre><code>Object.prototype.name;
  </code></pre>
  
  <p>And later, </p>
  
  <pre><code>this.name = "Freddy";
  </code></pre>
  
  <p>This is within functions called with 'new' so in this case, as I understand it, <code>this</code> refers to the current object. What puzzles me is what the prototype declaration is doing and why do we use it for instance variables?</p>
  
  <hr>
  
  <p><strong>Clarification</strong>: In the following code, I don't see what the prototype declaration of radius is achieving:</p>
  
  <pre><code>(function(){
      // constructor
      function MyCircle(radius){
          this.radius = radius;
      }
      MyCircle.prototype.radius;
      this.area = function(){
          return 3.14*this.radius*this.radius;
      };
      window.MyCircle = MyCircle;
  }());
  </code></pre>