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(); 

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
What is scope in JavaScript

What is scope in JavaScript

What is scope in JavaScript …

read more