Skip to content

Instantly share code, notes, and snippets.

function Rect(width, height) {
this.width = width;
this.height = height;
}
Rect.prototype.type = function() { return "rect"; };
function Square(width) {
return new Rect(width, width);
}
Square.prototype.type = function() { return "square"; };