This code works:
class Test {
#field
get field() {
return this.#field;
}
}
But if I want to calculate field name I have to use square brackets but it doesn't work:
class Test {
#field;
get field() {
return this['#field'];
}
}
Is there any way to get private field with calculated name?
It looks like it is a problem to hand over a string which has a special meaning.
If really necessary, you evaluate a string.