I have a code in which I declare a private class member using "#" and then initialize it in the constructor and then when I try to set / access the value I get the following error
Uncaught TypeError: Cannot read private member #mouse from an object whose class did not declare it
at mouseDownEvent
where the mouseDownEvent is the function, where I try to access the values
code example: ( refer to the EDIT code )
class Testing
{
#property;
constructor()
{
this.#property = new Vector2();
}
mouseDownEvent()
{
this.#mouse.x = somevalue; <- error is here
}
}
EDIT
class Testing
{
#mouse;
constructor()
{
this.#mouse= new Vector2();
}
mouseDownEvent()
{
this.#mouse.x = somevalue; <- error is here
}
}