I have an experience with the C# programming language, but I also have to work with the JS now and it\'s rather new for me.
I have tried to develop a simple class em
Javascript still does not support encapsulation out of the box. However there is a proposal to make it so.
ECMA TC39 had proposed a private syntax. According to the proposal, in order to make a javascript class field private you need to prefix it with a hash '#'. This is to provide some sort of runtime encapsulation.
Example:
class B {
#hidden = 0;
m() {
return this.#hidden;
}
}
Chrome supports this since Chrome v74. If this private-syntax becomes a standart we will be able to benefit from runtime encapsulation in javascript.