Define a js function inside another js function
<p>I've recently found this code snippet:</p>

<pre><code>function start() {

    function sleep(milliSeconds) {
        var startTime = new Date().getTime();
        while (new Date().getTime() &lt; startTime + milliSeconds);
    }

    sleep(10000);
    return "Hello Start";
}
</code></pre>

<p>What advantages do we have defining functions this way instead of using a 'traditional' approach?</p>

<p>Thanks in advance.</p>
