title: Javascript Objects & Prototypes
body: <p>I am new to Javascript and confused about the outcomes of the following statements. Could you help clarifying the reason behind each outcome? It would be appreciated if you could also suggest resources that clearly explain the expected behavior in these cases.</p>
  
  <pre><code>function Person(){
     this.a = function(){alert("a")};
  }
  
  Person.prototype.b = function(){alert("b")};
  Person.c=function(){alert("c")};
  
  var test = new Person();
  test.a(); // works
  test.b(); // works
  test.prototype.b(); //error
  
  Person.prototype.a(); // error (why?)
  Person.prototype.b(); //works (why?)
  
  Person.c(); //works
  
  Person();
  Person.a(); /* error (Person() call should have set this.a 
                 on the Person object just like the c method, 
                 why doesn’t it work?) */
  
  Person.b();//error (why?)
  </code></pre>