SOURCE

function Person(name){
   this.name =  name 
   this.kind  = 'nan'
   this.say = function(){
       console.log(this.name)
   } 
}

Person.prototype.run = function (){
    console.log(this.kind)
}


// const a  =  new Person('小方')
// console.log(a.name)
// console.log(a.kind)
// a.say()
// a.run()

// 继承person
function Student(name,gloat){
    Person.call(this,name)
    this.gloat = gloat
    this.studentname = function(){
        console.log(this.name)
    } 
}
// Student.prototype.__proto__ = Person.prototype
// Student.prototype = new Person()
let f = function (){}
f.prototype = Person.prototype
Student.prototype = new f()

Student.prototype.gg = function (){
    console.log(this.gloat)
}

const c =  new Student('小方',100)
console.log(c.name)
console.log(c.kind)
c.studentname()
c.gg()
c.say()
c.run()
console 命令行工具 X clear

                    
>
console