Closures are a powerful and flexible way to create new functions out of existing functions. You can think of them as being function factories, that can create new functions according to a template and one or more parameters.

In this article we will look at how to use a closure to compose two functions, as a simple illustration of why and how we use closures.