Is there a better way to repeat a function, rather than using setTimeout
<p>Is there a better way to repeat a function infinite times?</p>

<p>Rather than using:</p>

<pre><code>    setTimeout(myfunction(), 10)
</code></pre>

<p>How would I add that into this? When I replaced setTimeout it went weird with the order.</p>

<pre><code>    &lt;img id="slideshow" src="4.JPG" alt="cheese" width="264" height="264"/&gt;
            &lt;script&gt;
                source=["1.jpg", "2.JPG", "3.JPG", "4.JPG"];
                var i=0
                function show(){
                document.getElementById("slideshow").src = source[i];
                if (i&lt;source.length - 1)                
                i++
                else
                i=0
                setTimeout("show()",2500)                       
                }
                show()
            &lt;/script&gt;
</code></pre>
