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);






External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.