function Person(name, age, gender){
this.name = name;
this.age = age;
this.gender = gender;
}
Person.prototype.greeting = function(){
console.log('Hi, I\'m ' + this.name + '.');
}
function Teacher(name, age, gender, subject){
Person.call(this, name, age, gender);
this.subject = subject;
}
Teacher.prototype = Object.create(Person.prototype);
Teacher.prototype.constructor = Teacher;
Teacher.prototype.greeting = function(){
console.log('I\'m a teacher, name is ' + this.name);
}
let person1 = new Person('lily',25,'female');
console.log(person1.name);
person1.greeting();
let teacher = new Teacher('teacher Wang', 40, 'male');
console.log(teacher.name);
teacher.greeting();
console.log(teacher.__proto__);
console.log(Teacher.prototype.constructor);
console