How to animate the JavaScript counter
<p>I am counting values from 0 to 100 in JavaScript, but the whole count should take 3 seconds to reach 0 to 100.but right now its happening withing milliseconds.</p>

<p>how can i do that?</p>

<pre><code>&lt;span&gt;&lt;span id="counter"&gt; &lt;/span&gt; of 100 files&lt;/span&gt;


        &lt;script&gt;
            for(var i=0;i&lt;=100;i++)
            {       
                setTimeout(document.getElementById("counter").innerHTML = i, 3000);
            }
        &lt;/script&gt;
</code></pre>

<p>Example:</p>

<p><a href="http://www.downgraf.com/wp-content/uploads/2014/09/03-yodaloader.gif" rel="nofollow">http://www.downgraf.com/wp-content/uploads/2014/09/03-yodaloader.gif</a></p>