<script type="text/javascript">
function Human(name) {
this.name = name
this.kingdom = 'animal'
this.color = ['yellow', 'white', 'brown', 'black']
}
function Chinese(name, age) {
Human.call(this, name)
this.age = age
this.color = 'yellow'
}
// 补全代码
Human.prototype.getName = function () {
return this.name
}
/*Chinese.__proto__ = Human;
Chinese.prototype.__proto__ = Human.prototype; //对象原型 __proto__ 指 原型对象 prototype
*/
Chinese.prototype = new Human();
Chinese.prototype.constructor = Chinese;
Chinese.prototype.getAge = function () {
return this.age
}
</script>
