//......
var vehicle1 = newClearVehicle(); // Такой вызов чистого объекта
vehicle1['wheelsType'] = 3;
vehicle1['color'] = 2;
var vehicle2 = newClearVehicle();
vehicle2['wheelsType'] = 4;
//......
function newClearVehicle() {
return {
wheelsType: 0,
color: 0
}
}
function ClearVehicle(wheelsType, color) {
this.wheelsType = wheelsType || 0;
this.color = color || 0
}
var vehicle1 = new ClearVehicle(3, 2);
var vehicle2 = new ClearVehicle(4);
ClearVehicle.prototype.setWheelsType = function(wheelsType) {
this.wheelsType = wheelsTypeж
}
ClearVehicle.prototype.setColor = function(color) {
this.color = color
}
var vehicle = new ClearVehicle();
vehicle.setColor(3);