Let me quote an excellent article about timers by John Resig:
setTimeout(function(){
/* Some long block of code... */
setTimeout(arguments.callee, 10);
}, 10);
setInterval(function(){
/* Some long block of code... */
}, 10);
These two pieces of code may appear to
be functionally equivalent, at first
glance, but they are not. Notably the
setTimeout code will always have at
least a 10ms delay after the previous
callback execution (it may end up
being more, but never less) whereas
the setInterval will attempt to
execute a callback every 10ms
regardless of when the last callback
was executed.
Intervals may execute back-to-back with no delay if they take long enough to execute (longer than the specified delay).