题解 | #类继承#

类继承

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

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

全部评论

相关推荐

10-17 23:18
已编辑
西北农林科技大学 Web前端
独行m:给25可以试试,但他只能给12,那就是纯纯的事精
秋招,不懂就问
点赞 评论 收藏
分享
10-28 10:48
已编辑
门头沟学院 Java
孩子我想要offer:发笔试后还没笔试把我挂了,然后邮箱一直让我测评没测,后面不知道干嘛又给我捞起来下轮笔试,做完测评笔试又挂了😅
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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