What is the difference between declaring variable in for loop and an outside loop?
<p>I searched for this question but the answers I got not solve my question . Here is my question , I have a array with 10 members .</p>

<p><strong>Js Code</strong></p>

<pre><code>var array = [1,2,3,4,5,6,7,8,9,10];
</code></pre>

<p><strong>Loop 1:</strong></p>

<pre><code>for(var i=0,len=array.length;i&lt;len;i++){};
</code></pre>

<p><strong>Loop 2</strong></p>

<pre><code>var len = array.length;
for(var i=0;i&lt;len;i++){};
</code></pre>

<p><strong>Loop 3</strong></p>

<pre><code>for(var i=0;i&lt;array.length;i++){}
</code></pre>

<p>I know there is a major performance difference between 1 and 3 . But , is there any performance difference between 1 and 2 ? . </p>
