What is a closure in JavaScript?
Question :
What is a closure in JavaScript?
A closure is a combination of a function and its lexical environment (the variables it has access to). It allows a function to access variables from its outer scope even after the outer function has finished executing.