// Shape - スーパークラス function Shape() { this.x = 0; this.y = 0; } // スーパークラスのメソッド Shape.prototype.move = function (x, y) { this.x += x; this.y += y; console.info("Shape moved."); }; // Rectangle - サブクラス function Rectangle() { Shape.call(this); // call super constructor. } // サブクラスはスーパークラスを拡張する Rectangle.prototype = Object.create(Shape.prototype, { // Rectangle.prototype.constructor を Rectangle に設定しな

