functionPerson(){this.name='tom'}Person.prototype.sayName=function(){
console.log(`name is ${this.name}`)}functionStudent(){this.score=80}Student.prototype=newPerson()Student.prototype.constructor=Student
let stu=newStudent()
console.log(stu)
console.log(stu.name)
console.log(stu.score)
stu.sayName()
console.log(stu.__proto__)// Person { score: 80 }// tom// 80// name is tom// Person { name: 'tom' }
functionPerson(){this.name='tom'}Person.prototype.sayName=function(){
console.log(`name is ${this.name}`)}functionStudent(){this.score=80}Student.prototype=newPerson()Student.prototype.constructor=Student
let stu=newStudent()
console.log(stu)
console.log(stu.name)
console.log(stu.__proto__.name)
console.log(stu.score)
stu.sayName()
console.log(stu.__proto__)// Person { score: 80 }// tom// tom// 80// name is tom// Person { name: 'tom' }
functionPerson(name){this.name=name
}functionStudent(){}Student.prototype=newPerson('tom')Student.prototype.constructor=Student
let stu=newStudent()
console.log(stu.name)
functionPerson(name){this.name=name
this.score={
math:80}}//父类原型链上的方法Person.prototype.sayName=function(){
console.log(`name is ${this.name}`)}functionStudent(name){Person.call(this,name)this.age=12}let stu=newStudent('tom')
console.log(stu)
stu.sayName()//stu.sayName is not a function
console.log(stu.__proto__)//{}