IG Group interview question

What is a closure in JavaScript?

Interview Answer

Anonymous

10 July 2019

A closure is when an inner function has access to the variables and parameters of its outer function, even after the outer function has returned. To use a closure, define a function inside another function and expose it. To expose a function, return it or pass it to another function.