I have a basic class like so:
class Something
{
constructor() {
this.something = 0;
}
increaseSomething(incr = 1) {
this.something += incr;
}
}
However, right now I can simply do new Something().something += 100
Is there any way to keep something attribute as protected
? I want increaseSomething
to be my public setter.
Ps. I know it can be done with functions but I want to do it with ES6 classes.