Currently, I am working with a class setup like this:
class MyClass {
constructor(privateInfo) {
this.a = "a";
this.b = "b";
}
myMethod() {
return privateInfo;
}
}
It seems that the privateInfo
variable needs to be accessed, but it is not defined in the constructor.
Using private properties is not an option, as the property will be included in the stringified object which is not desired.
Is there a way to work around this? Any hints or suggestions would be greatly appreciated.