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对象
原文:https://www.cnblogs.com/tllw/p/7776707.html