setTimeout
and setInterval
setTimeout
Caveat: The this
object for the function
passed to setTimeout
is always the window
that setTimeout
was called on.
Caveat: The delay is clamped from below, to 10ms in
some browsers, 4ms in others, 2ms in still others, 1ms in some.
setInterval
Just like setTimeout
, but fires over and
over again until canceled. The firing times may differ for an interval
and a timeout that resets itself.
Canceling intervals and timeouts
Both setTimeout
and setInterval
return a handle that can be used to cancel the
timer using clearTimeout
and clearInterval
respectively.
Next
Previous