You are on page 1of 1

CLOSURES

1. My definition of the given concept would be:


a closure gives you access to an outer function's scope from an inner function.
(the lexical environment)
In JavaScript, closures are defined as inner functions that have access to
variables and parameters of the outer functions even after the outer function
has returned.

2. The real-life use-case scenarios of the Closures are as follows:


Closures are frequently used in JavaScript for object data privacy, in event
handlers and callback functions, and in partial applications, currying, and other
functional programming patterns.

3. Benefits
We can access the outer variables from the inside variable, even if the outer
function has already returned.

4. Extra Information about the Closures


In JavaScript, closures are created every time a function is created, at function
creation time.

You might also like