DEV Community

[Comment from a deleted post]
Collapse
 
jreina profile image
Johnny Reina

A closure is a function that returns another function

A function that returns another function is a higher-order function. A closure is simply a technique for accessing a variable outside of its scope. I think this description of a closure is a great definition. It also describes higher-order functions, partial application, and curried functions, all of which are shown in your examples.

All that being said, closures are an extremely important concept and are fundamental to understanding many design patterns.