Javascript Closures (ES6 EcmaScript2015)

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

In simple words closure are functions within function or functions inside another function

All the variables or properties of parent function are visible in child functions: say in below example name variable of parent function myFun() is visible inside child function i.e inside displayName()

Closure Basic program:





This is it , a bit smaller module but assume will have given a basic understanding about the concept.

For more follow:

Thanks for your time, Have a great Time Cheers..!!