编辑代码

function Parent(name, age) {
    this.name = name;
    this.age = age;
    console.log('parent is running.');
}
function Child(name, age) {
    Parent.apply(this, arguments);
}
var F = function() {};
F.prototype = Parent.prototype;
Child.prototype = new F();
var instance = new Child('Allen', 5);
Child.prototype.sex = 'male';
console.log(instance.sex);
console.log(Parent.prototype);