Assigning prototype inside constructor
<p>I have this code:</p>

<pre><code>var MyClass = function(b) {
    this.a = b;
    this.getA = function() {
        return that.a;
    }
}

var SecondClass = function(b) {
    this.prototype = new MyClass(b);
    this.getB = function() {
        return 6;
    }
}

var a = new SecondClass(2);
console.log(a.getA());
</code></pre>

<p>The output tells me that a has no method called getA()</p>

<p>I assumed that doing this.prototype = new MyClass() inside the constructor for SecondClass would cause it to inhert methods from MyClass?</p>

<p>I'm sure there are better ways to do this, but I am trying to understand the behaviour of the prototype keyword.</p>
