Advantage of using prototype over creating functions in the constructor?
<p>Here's a constructor for an animal object.</p>

<pre><code>function Animal(name, sound) {
   this.name = name;
   this.sound = sound;
   this.makeSound = function() {
       alert(sound);
   }
}
</code></pre>

<p>I have found that a developer can instead add an instance method to the Animal class via</p>

<pre><code>Animal.prototype.makeSound = function() { alert(this.sound); };
</code></pre>

<p>and exclude the makeSound method from the constructor. What is the advantage of using this prototype design pattern?</p>
