Lexical scope means the scope chain is fixed at write time. When a function is defined inside another, it gets an outer reference to the outer function's environment. That reference travels with the function object, even after the outer function returns.
What Is a Closure in JavaScript?
How does a closure work in JavaScript?
The answer
More FAQs in What Is a Closure in JavaScript?
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.