Created
December 5, 2019 22:22
Star
You must be signed in to star a gist
How to get parameter in class, if this parametr changet inside class.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Click{ | |
constructor(item){ | |
this.item=item; | |
this.init; | |
} | |
get init(){ | |
this.addItem; | |
this.addinTime; | |
} | |
get addinTime(){ | |
setTimeout(()=>{ | |
this.addItem; | |
},5000) | |
} | |
get addItem(){ | |
this.item+=10; | |
console.log(this.item); | |
} | |
get myItem(){ | |
return this.item; | |
} | |
} | |
let show= new Click(20); | |
console.log(show.myItem); | |
//как в методе myItem (show.myItem) отображать ИЗМЕНЕННЫЙ параметр this.item , если этот параметр меняется внутри класса |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment