class a
{
constructor(val)
{
this.val = val;
}
#privFunction()
{
console.log(this.val);
}
publicFunction()
{
var fun = function()
{
this.#privFunction();
};
fun();
}
}
const class1 = new a("Hello world!");
class1.publicFunction();
This will return an error that the this.#privFunction() function is not declared in this scope. If I need to find a way to declare a private function in a function that's declared inside of a class' public function is this possible?