Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

js es6 class private method

class MyClass
{
  	// Prepend hash to make it private. Browser support at:
  	//	https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields#browser_compatibility
    // Dynamic access (ie: this.#[fieldName]) is disallowed by design.
  	#myPrivateMethod() {
    	// do private things
	}
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #class #private #method
ADD COMMENT
Topic
Name
5+5 =