Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Laptop{
- isOn = false
- constructor(info,quality){
- this.info = {
- producer : info.producer,
- age : info.age,
- brand : info.brand,
- }
- this.quality = quality
- }
- get price(){
- return ((800 - (this.info.age * 2)) + (this.quality * 0.5))
- }
- turnOn(){
- this.isOn = true
- this.quality--
- return this.isOn
- }
- turnOff(){
- this.isOn = false
- this.quality--
- return this.isOn
- }
- showInfo(){
- return JSON.stringify(this.info)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement