Is there any difference between constructor function and prototype object when using inheritance?
<p>Consider the following to JavaScript snippets:</p>

<pre><code>function foo() {
  this.bar = function() { };
}

// or... (if we used an empty constructor function)

foo.prototype.bar = function() { };
</code></pre>

<p>What's the difference when I do this:</p>

<pre><code>function baz() {
}

baz.prototype = new foo();
</code></pre>

<p>In both cases <code>baz</code> ends up having a member <code>bar</code> but what's the difference? Why would I do this in different places?</p>
