SOURCE

class Child {
	constructor(name, age) {
		this.name = name;
		this.age = age;
	}
	method() {
		return "My name is " + this.name + "." + " I'm " + this.age + " years old";
	}
}

class Son extends Child {
	constructor(name, age, sex) {
		super(name, age);
		this.sex = sex;
	}
}

let son = new Son("Jim", 18, "boy");
console.log(son);
console.log(son.method());
console 命令行工具 X clear

                    
>
console