Understanding closures in JavaScript. A closure is a feature in JavaScript where an inner function has access to the outer (enclosing) function’s variables — a scope chain.