//父类
function superClass(name){
this.name = name;
this.books = ['html','css','javascript'];
}
superClass.prototype.getName = function(){
console.log(this.name);
}
//子类
function subClass(name,time){
superClass.call(this,name);
this.time = time;
}
subClass.prototype = superClass.prototype;
subClass.prototype.getTime = function(){
console.log(this.time);
}
var s1 = new superClass();
var s2 = new subClass('klkx',2018);
s2.books.push('vue');
console.log( s2 );
s2.getName();
console.log( s2.books );
console.log( s1.books );