clousures made simple

https://www.freecodecamp.org/news/javascript-closures-simplified-d0d23fa06ba4/

even when the execution context of the function completed, inner function which is in the ourter function can able access the outer function variables,arguments.
in other words closure is created when a child function keep the environment of the parent scope even after the parent function has already executed https://www.geeksforgeeks.org/closure-in-javascript/


Another extremely important thing to understand is that a closure is created at every function call. Whenever I’m using the closure, it will reference the same outer scope. If any variable is change in the outer scope, than the change will be visible in the next call as well

https://www.codingame.com/playgrounds/6516/closures-in-javascript-for-beginners
Advertisements