题解 | JS13 类继承

        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;
            }
        }
全部评论

相关推荐

头像
10-15 22:27
已编辑
门头沟学院 C++
罗格镇的小镇做题家:我投了hr打电话来说学历太低了不符合要求,建议投荣耀,结果荣耀也投了一定水花没有,非本211硕
投递华为等公司10个岗位
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务