题解 | #类继承#

类继承

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

{"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                // 补全代码\n                getName() {\n                    return this.name;\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>","css":"","js":""}

全部评论

相关推荐

09-14 20:51
四川大学 Java
慢热的鲸鱼在学习:985加粗就行了,第二个项目来不及准备也没事,省的写了问你你还不会。你只需准备面试八股和项目场景,剩下的交给985。即使面不过也没事,面试经验是最重要的,你现在不缺时间
简历中的项目经历要怎么写
点赞 评论 收藏
分享
09-08 19:12
东华大学 C++
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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