SOURCE

function Child(name, age) {
	this.name = name;
	this.age = age;
}

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

function Daughter(sex) {
	this.sex = sex;
}

Daughter.prototype = Object.create(Child.prototype);
Daughter.prototype.constructor = Daughter;

let D1 = new Daughter("girl");
D1.name = "Lili";
D1.age = 18;
console.log(D1);
console.log(D1.method());
console 命令行工具 X clear

                    
>
console