题解 | 类继承

类继承

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

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
  </head>
  <body>
    <script type="text/javascript">
      class Human {
        constructor(name) {
          this.name = name;
          this.kingdom = "animal";
          this.color = ["yellow", "white", "brown", "black"];
        }
        // 补全代码
        getName() {
          return this.name;
        }
      }

      class Chinese extends Human {
        constructor(name, age) {
          super(name);
          this.age = age;
        }

        getAge() {
          return this.age;
        }
      }
    </script>
  </body>
</html>

全部评论

相关推荐

牛客33727151号:不是哥们我以为驾照是段子呢
点赞 评论 收藏
分享
king122:实习经历可以重点写这里这里写的清晰一点,分点写。技能特长一般是放在上面的,而且你的实习经历不能只写实现了一些简单的接口,你要去写一些难点和亮点。甚至可以写一些数字指标上去,只要你能配合业务讲出来,根据我说的这些自己简单包装一下,面试应该会更多,至于笔试和八股,那就只能纯靠自己了,对项目包装感兴趣可以找我
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务