What is return function used for in JavaScript
<p>I have this incredibly simple example that works without return function and fails with it:</p>

<pre><code> function hello() {
    alert('hello');
}

function hi() {
    return function() {
        alert('hi');
    }
}
</code></pre>

<p>I know that by doing <code>hi()();</code> I am able to run the second function but I rarely ever see this in code. How can I do return function without doing that as I see people do that all the time.</p>
