Is javascript str.length calculated every time it is called or just once?
<p>Which way is more efficient? Is there a difference?</p>

<p>This one:</p>

<pre><code>var str = 'abc';

if(str.length == 20) {
    //...
}

if(str.length == 25) {
    //...
}

// and so on
</code></pre>

<p>Or this one:</p>

<pre><code>var str = 'abc';
var length = str.length;

if(length == 20) {
    //...
}

if(length == 25) {
    //...
}

// and so on
</code></pre>
