html代码
js代码
//父类 class A{ constructor(name,age,sex){ this.name = name; this.age = age; this.sex = sex; } myInfo(){ return this.name+"=="+this.age+"==="+this.sex; } } //子类 class B extends A{ constructor(x, y, z, position){ super(x, y, z); this.position = position; } myInfo(){ return super.myInfo() + "===="+this.position; } } var b = new B(1,2,3,4); $('#log').append(b.myInfo());
css代码