How to use composition with JavaScript
<p>I have something like this:</p>

<pre><code>dog = function () {
  this.age;
  this.name;
  this.dog1 = new dog.shepherd();
}

dog.prototype = {
  bark : function () {
    alert( (this.getName()) + " is barking." );
  },

  [3]**getName** : function () {
    return this.name;
  }
}

dog.shepherd = function () {
  this.something;
}

dog.shepherd.prototype = function () {
  guard : function () {
        alert( ([2]**parent.getName()**) + " is barking." );
  }
}

window.onload = function () {
  var n = new dog();
  [1]**n.guard()**;
}
</code></pre>

<p>How can I use a function which is prototyped to the dog from dog.speherd prototype?</p>

<p>In other words, when [1] is executed, then [2] is written in pseudo-code, to call [3].</p>

<p>I know this code shouldn't work; it's just to help me explain what I want.</p>
