题解 | #继承#
继承
https://www.nowcoder.com/practice/ee1e5ee81b1c4fbb8c05a4e903621762
<script type="text/javascript"> function Human(name) { this.name = name this.kingdom = 'animal' this.color = ['yellow', 'white', 'brown', 'black'] } Human.prototype.getName = function() { return this.name } function Chinese(name,age) { Human.call(this,name) this.age = age this.color = 'yellow' } // 补全代码 // 2.继承 Chinese.prototype = new Human() Chinese.prototype.constructor=Chinese Chinese.prototype.getAge = function() { return this.age } </script>函数继承