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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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.