function Animal(name) {
this.name = name;
this.play = function() {
console.log(this.name + ' is playing')
}
}
Animal.prototype.eat = function(food) {
console.log(this.name + ' is eating' + food)
};
//将父类的实例作为子类的原型
function Dog() {}
Dog.prototype = new Animal();
Dog.prototype.name = 'dog';
let dog = new Dog();
console.log(dog);
console.log(dog.name);
console.log(dog.__proto__);
dog.play();