ECMAScript6的原型
class Car { constructor(name){ this.name = name; } getName(){ } } class Ferrari extends Car{ constructor(name){ super(name); } getName(){ } } let car = new Car(); let ferrari = new Ferrari(); console.log('Car.prototype',Car.prototype); // Object{} console.log('Ferrari.prototype',Ferrari.prototype); // Car{} console.log('car.constructor===Car',car.constructor===Car); // true console.log('ferrari.constructor===Ferrari',ferrari.constructor===Ferrari); // true console.log('car.__proto__===Car.prototype',car.__proto__===Car.prototype); //true console.log('ferrari.__proto__===Ferrari.prototype',ferrari.__proto__===Ferrari.prototype); //true console.log('Car.prototype',Car.prototype); // 对象 console.log('Car.prototype.getName',Car.prototype.getName); // getName()函数