Micro-channel scan code number of public attention: the front end of the front end of a large front-end , the pursuit of more refined reading experience, together to learn ah
After Follow Send key information , free access to a complete set of front-end systems and learning materials old boy python courses
functionPerson(name){this.name = name;}
Person.prototype.say=function(){
console.log(`My name is ${this.name}`)}functionStudent(name){
Person.call(this, name)}// Object.create方法创建一个新对象,使用现有的对象来提供新创建的对象的__proto__
Student.prototype=Object.create(Person.prototype);// 修正构造函数指向 Person=>Student
Student.prototype.constructor=Student;var stu=newStudent("tom");
stu.say()//My name is tom