Closed JingchaoZhao closed 5 years ago
function Foo(name) { this.name = name } Foo.prototype.myName = function () { return this.name } function Bar (name, label) { Foo.call(this, name); this.label = label } Bar.prototype = Object.create(Foo.prototype) Bar.prototype.myLabel = function () { return this.label }
function Foo(name) { this.name = name } Foo.prototype.myName = function () { return this.name } function Bar (name, label) { Foo.call(this, name); this.label = label } Bar.prototype = Object.create(Foo.prototype) Bar.prototype.myLabel = function () { return this.label }