题解 | #寄生组合式继承#

寄生组合式继承

https://www.nowcoder.com/practice/dd8eb918b5d343cc8be77a69630f59bf

{"html":"<!DOCTYPE html>\n<html>\n    <head>\n        <meta charset=utf-8>\n    </head>\n    <body>\n    \t\n        <script type=\"text/javascript\">\n            // 补全代码\n            function Human(name) {\n                this.name = name\n                this.kingdom = 'animal'\n                this.color = ['yellow', 'white', 'brown', 'black']\n            }\n\n            Human.prototype.getName = function() {\n                return this.name;\n            }\n\n            function Chinese(name,age) {\n                Human.call(this, name)\n                this.age = age;\n                this.color = 'yellow'\n            }\n\n            Chinese.prototype = Object.create(Human.prototype)\n\n            Chinese.prototype.getAge = function() {\n                return this.age;\n            }\n\n            Chinese.prototype.constructor = Chinese;\n\n        </script>\n    </body>\n</html>","css":"","js":""}

全部评论

相关推荐

职场水母:为啥你们整简历都喜欢整一大堆没用的,是期待让hr觉得很多,自己很厉害吗
0offer是寒冬太冷还...
点赞 评论 收藏
分享
Java面试先知:我也是和你一样的情况,hr 说等开奖就行了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务