setTimeout vs setInterval in javascript
<p>Hi can we change setInterval to setTimeout function, it is working fine I want to know can it is done with setTimeout</p>

<pre><code>&lt;head&gt;
&lt;script type="text/javascript"&gt;
$(function() {
    var current = $('#counter').text();
    var endvalue = 50
    $('a').click(function() {
        setInterval(function() {
            if (current === endvalue) {

            } else {
                current++;
                $('#counter').text(current)
            }
        }, 50)
    })
})
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="counter"&gt;0&lt;/div&gt;
&lt;a href="#"&gt;Click&lt;/a&gt;
&lt;/body&gt;
</code></pre>
