ES5
function SuperClass(name) {
this.name=name;
this.books=['js','vue','angular'];
}
SuperClass.prototype.showBooks=function () {
console.log(this.books);
}
function SubClass(name,time) {
SuperClass.call(this,name);
this.time=time;
}
SubClass.prototype=new SuperClass();
SubClass.prototype.getTime=function () {
console.log(this.time);
}
var instance1=new SubClass("js book",2014);
instance1.books.push("design pattern");
var instance2=new SubClass("java book",2015);
instance1.showBooks();
instance2.showBooks();