JavaScript

Prototype

function Rectangle(w, h){
        this.width = w;
        this.height = h;
}

Rectangle.prototype.area = function() {
        return this.width * this.height;
}
        
var r1 = new Rectangle(2,3);
r1.area()

José M. Vidal .

54 of 65