Private methods in Javascript classes
If you want to define a private property or method in a javascript class, you can define it by prepending a #
sign in front:
class ClassWithPrivate {
#privateField;
#privateFieldWithInitializer = 42;
#privateMethod() {
// …
}
}
In this way both the private properties and methods are not accessible from outside the body of the javascript class.
Mozilla documentation has a lot of more information about this.