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