Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

In Self Invoking Functions, the This Below Console.Logs The Created Object

	 (function()
 {
	 
	 
	 
	 class Person
	 {
	constructor(name)
		 {
			 this.name = name;
			 console.log(this);
		 }	
	 }
	 
 
	 const p = new Person("John Smith");
	 
 })()
 /*console.log(this) will be Object with name of "John Smith"*/
 
 
PREVIOUS NEXT
Tagged: #In #Self #Invoking #This #Below #The #Created #Object
ADD COMMENT
Topic
Name
8+4 =