Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Declaring A Internal Method Of A Class

/*sayName() is an internal method, you cannot use sayName with an instance of Person but you CAN use yellName*/
class Person{
	 	
		constructor(name)
		 {
			 this.name = name;
			 this.sayName();
           this.yellName = function()
           {console.log(this.name);
           }
		 }
		 
	 		  sayName()
		 {
		 	
			console.log(this.name)
		 }
	 }
 
PREVIOUS NEXT
Tagged: #Declaring #A #Internal #Method #Of #A #Class
ADD COMMENT
Topic
Name
8+1 =