Advertisement
ErolKZ

Untitled

Dec 21st, 2021
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1.  
  2. class Laptop {
  3.  
  4. constructor(info, quality) {
  5.  
  6. this.info = info;
  7.  
  8. this.isOn = false;
  9.  
  10. this.quality = quality;
  11.  
  12. }
  13.  
  14. turnOn() {
  15.  
  16. this.isOn = true;
  17.  
  18. this.quality--;
  19.  
  20. }
  21.  
  22. turnOff() {
  23.  
  24. this.isOn = false;
  25.  
  26. this.quality--;
  27.  
  28. }
  29.  
  30. showInfo() {
  31.  
  32. let info = {};
  33.  
  34. for (let oLdKey in this.info) {
  35.  
  36. let newKey = JSON.stringify(oLdKey);
  37.  
  38. info[newKey] = this.info[oLdKey];
  39.  
  40. }
  41.  
  42. return info;
  43.  
  44. }
  45.  
  46. get price() {
  47.  
  48. let price = (800 - (this.info.age * 2) + (this.quality * 0.5));
  49.  
  50. return price;
  51.  
  52. }
  53.  
  54.  
  55. }
  56.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement