What is closure in JavaScript

What is closure in JavaScript

Closure in JavaScript

A closure is the combination of a function and the lexical environment within which that function was declared.

A closure is an inner function that has access to the outer enclosing function's variable scope chain.

A closuer can access its own variables, outer functions variables and global variables.

We can create a closure by adding a function inside another function.

 	function show() { 	  
		var name = 'My Name'; // name is a local variable created by show 	  
		
		function displayName() { 
			// displayName() is the inner function, a closure 	    
			alert(name); // use variable declared in the parent function     	  
		} 	  
	
		displayName();     	
	} 	
	
	show(); 

What is SEO

What is SEO

SEO is the part of digital marketing. SEO are two types one is on page SEO and another is off page SEO. …

read more
Security Checks in Node Js

Security Checks in Node Js

We can use lots of security check on node js for development and production environment. …

read more