Advertisement
AreWe

Class Laptop

Jul 7th, 2020
1,284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Laptop {
  2.     constructor(info, quality) {
  3.         this.info = info;
  4.         this.quality = quality;
  5.         this.isOn = false;
  6.     }
  7.  
  8.     turnOn() {
  9.         this.isOn = true;
  10.         this.quality--;
  11.     }
  12.  
  13.     turnOff() {
  14.         this.isOn = false;
  15.         this.quality--;
  16.     }
  17.  
  18.     showInfo() {
  19.         return JSON.stringify(this.info);
  20.     }
  21.  
  22.     get price() {
  23.         return 800 - this.info.age * 2 + this.quality * 0.5;
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement