一、ES6 类 在 ES6 中,通过 extends 关键字实现类的继承,方式如下: class sup { constructor(name) { this.name = name; } printName() { console.log(this.name); } } class sub extends sup { constructor