Imagine that you have a function that expects a reference to a function. Here is an example of such a function

function bar(fn) { fn(); }


Now imagine that the function that you want to pass to bar accepts a parameter. Here is an example of such a function

function foo(arg) { alert(arg); }


With the help of a closure this is no problem

bar(function e() { foo('hello'); });


PS: Kudos go to Weirdan for providing the solution to this problem.