Check .length before applying substr()?
<p>In Javascript, is it better to do this:</p>

<pre><code>var string = 'hello';
if(string.length &gt; 10) {
    string = string.substr(0,10);
}
</code></pre>

<p>or simply:</p>

<pre><code>var string = 'hello';
string = string.substr(0,10);
</code></pre>

<p>I know the performance difference between the two won't be anything huge but I like my JS to run as lightly as possible!</p>

<p>Which is the best to use?</p>

<p>Thanks</p>
