function Vehicle(type) {
this.type = type;
}
Vehicle.prototype.wheels = 4;
Vehicle.prototype.getInfo = function() {
return `${this.type}: ${this.wheels}`;
};
const car = new Vehicle('Car');
const bike = Object.create(car);
bike.type = 'Bike';
bike.wheels = 2;
console.log(car.getInfo() + ' | ' + bike.getInfo());
Ответ: Car: 4 | Bike: 2
JavaScript test | #JavaScript & Max