window.onload = () => {
Father.prototype.firstName = 'zhuo';
function Father(){}
function Son(){}
function inherit(target, origin){
function F(){}
F.prototype = origin.prototype;
target.prototype = new F();
target.prototype.constructor = target;
target.prototype.uber = origin.prototype; //target的超类
}
inherit(Son, Father);
Son.prototype.lastName = 'xiao jun';
var father = new Father();
var son = new Son();
console.log('son firstName: '+ son.firstName);
console.log('son lastName: '+ son.lastName);
console.log('father firstName: '+ father.firstName);
console.log('father lastName: '+ father.lastName);
}
console