title: Javascript - Is there a difference between this.foo and this.prototype.foo
body: <p>Is there any difference between this:</p>
  
  <pre><code>function Foo(){
      this.bar = function(){
          console.log('hello');
      }
  }
  fooObj = new Foo();
  </code></pre>
  
  <p>and this?</p>
  
  <pre><code>function Foo(){
  
  }
  
  Foo.prototype.bar = function(){
      console.log('hello');
  }
  fooObj = new Foo();
  </code></pre>
  
  <p>These seem to behave the same, but I don't yet have a full understanding of prototypes. Is <code>foo.prototype</code> just a way of declaring a method outside of a class?</p>