首页 > 其他 > 详细

ES 6(二)

时间:2020-05-14 10:47:43      阅读:38      评论:0      收藏:0      [点我收藏+]
  1. Class类的继承:extends

    class Point{ }
        class ColorPoint extends Point{
            constructor(x,y,color){
                super(x,y);
                this.color=color;
            }
            toString(){
                return this.color+ +super.toString();
            }
        }

    super表示父类的构造函数,用来新建this对象

ES 6(二)

原文:https://www.cnblogs.com/tllw/p/7776707.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!