function Parent(name) {
this.name = name;
this.say = () => {
console.log(111);
};
}
Parent.prototype.play = () => {
console.log(222);
};
function Children(name,age) {
Parent.call(this,name);
this.age = age;
}
Children.prototype = Object.create(Parent.prototype);
Children.prototype.constructor = Children;
class Parent {
constructor(name) {
this.name = name
}
eat() {
console.log(this.name + ' is eating')
}
}
class Child extends Parent {
constructor(name, age) {
super(name)
this.age = age
}
}
let xm = new Child('xiaoming', 12)
console.log(xm.name)
console.log(xm.age)
xm.eat()