Closures are quite confusing entities in any programming language that supports them. It takes a while just to understand what they are, let alone use them to solve problems, but once understood, they can become a very powerful tool to use. You can log your functions, check how long they took to run, override variables from outer functions and a lot more.
Well, simply put, a closure is an inner function that has access to variables created in an outer function to a degree by which it can store and manipulate it even after the outer function has finished executing. …