Count how many digits in a var
<p>I'm trying to do frame by frame animation in html5, but the outputted files are numbered automatically like so 00010, 00011 etc.. </p>

<pre><code>var imgNumber = 00001;
var lastImgNumber = 00200;
</code></pre>

<p>Using the above and trying to increase the value by 1 removes the leading zeros. Perhaps, I can count how many digits are in the number, and depending on how many I can concatenate the extra zeros as a string? </p>

<p>What's the best way of approaching this?</p>
