I have this code similar to this:
class A {
constructor() {
this._a = 1;
}
get [val]() {
if (val == 'a') {
return this._a;
}
}
}
The above code is not valid, because val doesn't exist.
I want to get the computed getter name from within the getter and add to a variable val, so that I would know what property is being accessed.
How can I achieve this?