Is it possible to have getters nested in a class? If not, how would I achieve the desired behaviour?
For example:
class Character {
constructor(){
this.name = 'new character'
this.skills = {
acrobatics: {
value: 10, // user edits this value in app
get modifier(){
return this.value / 2 // this has to dynamically change when this.value changes.
}
}
}
}
get nameLength(){
return this.name.length // I'm aware that this works
}
}