1.

What is the purpose of closures in JavaScript?

Answer»

In JavaScript, a closure is known as a JavaScript closure or JS closure. Closures allow you to access the scope (variables and parameters) of an OUTER function from an inner function. Every TIME a JavaScript function is created, a closure is created. JavaScript closures allow you to CONTROL which variables are and are not in scope in a given function, as well as which variables are shared AMONG siblings within the same CONTAINING scope.



Discussion

No Comment Found