setTimeout not recursively calling anonymous function
<p>I was asked to make a small div cycle a fade in and fade out effect.  There are several ways to do this, but I am wondering why the following only runs the effect one time.</p>

<pre><code> $(document).ready(function() {
    (function(){
      setTimeout(function(){$("#foo").fadeOut().delay(800).fadeIn(800);},0)
    })();
 });
</code></pre>

<p>As far as I can tell, the function should run recursively, but it doesn't.</p>

<p>I went with <code>setInterval(function(){$("#foo").fadeOut().delay(800).fadeIn(800);}, 0);</code> because it gets the job done, but I'd still like to know why setTimeout didn't work as I expected.</p>
