3 ms·
getArea() { return this.width * this.height; } getIcon() { // if icon hasn't been loaded, load it return this.icon; }
by westoncb 7y ago
getArea() {
return this.width * this.height;
}
getIcon() {
// if icon hasn't been loaded, load it
return this.icon;
}
- weberc2 7y agoThose aren’t abstractions... Also, I’m not arguing that you can’t contrive an abstraction around a getter, I’m arguing that it’s useful to do so (so please spare me contrived examples!).