title: Why do we add functions to javascripts prototype?
body: <p>I am learning javascript.</p>
  
  <p>Why are functions defined outside of the object?</p>
  
  <pre><code>function Man(firstName, lastName) { 
  
      this.firstName = firstName; 
      this.lastName = lastName;   
  }
  
  Man.prototype.getName = function () {    
      return this.firstName + this.lastName;
  };
  </code></pre>
  
  <p>Looks a bit weird to me. It works if I add the function inside the class (removing .protoype etc) but I am being told to define the function outisde the object.</p>
  
  <p>Why?</p>