I've tried "quite new" syntax of private methods in Javascript using hash names.
This works:
class MyClass {
publictest () {
this.#test();
}
#test () {
window.alert("Yes!");
}
}
but this doesn't.
class MyClass {
publictest () {
let privateMethodName = "#test";
this[privateMethodName]();
}
#test () {
window.alert("Yes!");
}
}
Why? Is it possible to call private method using its name in variable?