Advertisement
kstoyanov

07. Class Vehicle js fundamentals

Jul 2nd, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Vehicle {
  2.   constructor(type, model, parts, fuel) {
  3.     this.type = type;
  4.     this.model = model;
  5.     this.parts = parts;
  6.     this.fuel = fuel;
  7.     this.parts.quality = this.parts.engine * this.parts.power;
  8.   }
  9.  
  10.   drive(fuelLoss) {
  11.     this.fuel -= fuelLoss;
  12.   }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement