Why can't I inherit the prototype of the Animal class in my javascript code?
<p>I am trying to create a new class <code>Dog</code> that inherits via prototypical inheritance from the <code>Animal</code> class:</p>

<pre><code>function Animal() {
  this.name = "animal";
  this.writeName = function() {
    document.write(this.name);
  }    
}

function Dog() {
  this.name = "dog";
  this.prototype = new Animal();
}

new Dog().writeName()
</code></pre>

<p>​
<a href="http://jsfiddle.net/BbrTF/1/" rel="nofollow">JS Fiddle</a></p>

<p>However, I get a Javascript error: <code>Uncaught TypeError: Object #&lt;Dog&gt; has no method 'say'</code>.</p>

<p>Why? Shouldn't the <code>Dog</code> object retain an <code>Animal</code> object as a prototype?</p>
