Uncaught TypeError: Object function has no method
<p>I am doing some experiments with classes in JS and cannot understand what is wrong with this code. The idea is to implement the calculateSurface method from Shape on the inherited class Rectangle, and calculate the surface with the parameters passed on the Rectangle class.</p>

<pre><code>function Shape (w,h){
    this.h = h;
    this.w = w;
    this.calculateSurface = function (){
        return this.w*this.h;
    };
}

function Rectangle (w,h){
    Shape.apply(this, arguments);
    this.w = w;
    this.h = h;
    this.calcSurface = function(){
        return Shape.calculateSurface(this.w, this.h);
    };
}

Rectangle.prototype = new Shape();
Rectangle.prototype.constructor = Rectangle;

var rec = new Rectangle(4,4);

console.log(rec.calcSurface());
</code></pre>

<p>The error I get is:</p>

<pre><code>    Uncaught TypeError: Object function Shape(w,h){
    this.h = h;
    this.w = w;
    this.calculateSurface = function (){
        return this.w*this.h;
    };
} has no method 'calculateSurface' 
</code></pre>

<p>Thank you for your help :) I have being doing this for the past 2 days :)</p>
