Advertisement
dpeeva

Class Vehicle

Jul 3rd, 2022
1,054
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.36 KB | None
  1. class Vehicle {
  2.     constructor(type, mode, parts, fuel) {
  3.         this.type = type
  4.         this.mode = mode
  5.         this.parts = {
  6.             engine: parts.engine,
  7.             power: parts.power
  8.         }
  9.         this.parts.quality = parts.engine * parts.power
  10.         this.fuel = fuel
  11.     }
  12.  
  13.     drive = (loss) => {
  14.         this.fuel -= loss
  15.     }
  16. }
Advertisement
RAW Paste Data Copied
Advertisement