# 自实现继承(单次继承构造函数) //父类的构造函数  function Father(name,age){   this.name=name   this.age=age  }    //父类的原型对象  Father.prototype={   constructor:Father,   say:function(){    console.log('i am '+this.name+' ,'+this.age+' years old')   }  }    //类继承:只继承父类模板,不继承原型对象(借用构造函数的方法实现继承)    //子类的构造函数  function Child(name,age){   //call apply 扩展父类模板使用范围   Child.superClass.constructor.call(this,name,age)  }  function extend(sub,sup){   //初始化:创建空函数,空模板和空原型对象   var f=new Function()   //空函数:只继承父类的原型对象   f.prototype=sup.prototype   //子类继承空函数,即可实现只继承原型对象,不继承构造函数   sub.prototype=new f()   //还原子类的原始构造器   sub.prototype.constructor=sub      //保存父类原型对象,作用1:解耦;作用2:便于获取父类的原型对象   sub.superClass=sup.prototype     }    extend(Child,Father)  var c1=new Child('li4',21)  c1.say()    console.log(Father.prototype.isPrototypeOf(c1))