function Super(){
this.a=[1,2,3,4]
}
Super.prototype.say=function(){
console.log(2222)
}
function Sub(){
}
Sub.prototype=new Super();
var sub1= new Sub();
var sub2=new Sub();
sub1.a.push(5)
function Super(){
this.a=[1,2,3,4]
}
Super.prototype.say=function(){
console.log(2222)
}
function Sub(num){
Super.call(this,num)
}
var sub1= new Sub([1,2,3,4]);
var sub2=new Sub();
console.log(sub1)
function Super(){
this.a=[1,2,3,4]
}
Super.prototype.say=function(){
console.log(2222)
}
function Sub(){
Super.call(this)
}
Sub.prototype=new Super()
var sub1= new Sub();
var sub2=new Sub();
console.log(sub1.b)
function Super(){
this.a=[1,2,3,4]
}
Super.prototype.say=function(){
console.log(2222)
}
function Sub(){
Super.call(this)
}
if(!Object.create){
Object.create=function(proto){
function F(){
F.prototype=proto
return new F();
}
}
}
Sub.prototype=Object.create(Super.prototype)
var sub1= new Sub();
var sub2=new Sub();
console.log(sub1.b)