Function which returns function
<p>Let's say there are two ways to define a function:</p>

<p>First way:</p>

<pre><code>Bar.prototype.foo = function ()
{
  // do something
}
</code></pre>

<p>Second way:</p>

<pre><code>Bar.prototype.foo = function ()
{
    return function () {
        // do something
    }
}
</code></pre>

<p>For sure the second way is useful in case of closure.</p>

<p>There are other case where the second way is preferable to the fist one?</p>
