class Person {
constructor(name) {
this.name = name;
}
speak() {
console.log('Hello this is ' + this.name);
}
}
class Child extends Person {
constructor(name, age) {
super(name);
this.age = age;
}
}
const child = new Child('John', 10);
child.speak()
console.log(child.name);
console.log(child.age);
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.