Javascript closure
<p>I read the () at the end of the closure will execute it immediately. So, what is the difference between these two. I saw the first usage in some code.</p>

<p>thanks.</p>

<pre><code>for (var a=selectsomeobj(),i=0,len=a.length;i&lt;len;++i){
        (function(val){
            anotherFn(val);
        })(a[i]);
}

for (var a=selectsomeobj(),i=0,len=a.length;i&lt;len;++i){
            anotherFn(a[i]);
}
</code></pre>
