题解 |JS18 继承

        function Human(name) {
            this.name = name
            this.kingdom = 'animal'
            this.color = ['yellow', 'white', 'brown', 'black']
        }
        
        function Chinese(name,age) {
            Human.call(this,name)
            this.age = age
            this.color = 'yellow'
        }

        // 补全代码
        Human.prototype.getName = function(){
            return this.name;
        }
        Chinese.prototype = new Human();
        Chinese.prototype.constructor = Chinese;
        Chinese.prototype.getAge = function(){
            return this.age
        }
全部评论

相关推荐

本人末二本,C++后端选手,目前手里两个意向:美团移动端和字节客户端。但全网都是劝退客户端的,不知道要不要接。但现在转java已经没办法赶上秋招了,很焦虑,不知道要不要转java备战春招,求各位大佬给给建议。
小破站_程序员YT:作为一个末二本,c++后端选手,手握两个大厂意向,你竟然还在犹豫要不要接,还要去转java? 真不知道你怎么想的。不知道有多少人羡慕你还来不及。
点赞 评论 收藏
分享
10-13 17:47
门头沟学院 Java
wulala.god:图一那个善我面过,老板网上找的题库面的
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务