JavaScriptでの継承例をES2015(ES6)のclassキーワードを使わずに書く。
function Parent(name){ this.name = name; } Parent.prototype.sayHello = function(){ console.log("Hello " + this.name); } function Child(name) { Parent.call(this,name); } Child.prototype = Object.create(Parent.prototype, { constructor: { value: Child, enumerable: false, writable: true, configurable: true } }); var c1 = new Child("c1"); c1.sayHello(); // Hello c1