Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Vehicle (speed,weight, manufacturer, isMilitary) {
- this.speed = speed; // Средняя скорость, км/ч
- this.weight = weight; // Вес транспорта, кг
- this.manufacturer = manufacturer; // Страна-производитель данной техники
- this.isMilitary = isMilitary || false; // Данная техника военная? - false по умолчанию
- this.getSpecifications = function () {
- this.isMilitary ? this.isMilitary = 'Да' : this.isMilitary = 'Нет';
- console.log (
- `Основные характеристики:
- Средняя скорость: ${this.speed} км/ч;
- Вес: ${this.weight} кг;
- Страна-производитель: ${this.manufacturer};
- Военная техника: ${this.isMilitary}.
- `
- )
- }
- }
- // ===
- function Auto (model, color, fuel, transmission) {
- Vehicle.apply(this, arguments)
- this.model = model; // Модель автомобиля
- this.color = color; // Цвет автомобиля
- this.fuel = fuel; // Тип топлива (бензин, дизель)
- this.transmission = transmission; // Коробка передач (механическая, автоматическая)
- }
- let toyota = new Auto (100, 3500, 'Japan', false, 'Toyota', 'white', 'petrol', 'automatic');
Advertisement
Add Comment
Please, Sign In to add comment