|
|
Q1109 What are the differences between setTimeout and setInterval, and where would the use of one would be preferable to the other?
irt.org | Knowledge Base | JavaScript | Timeout | Q1109 [ previous next ] Q1109 What are the differences between setTimeout and setInterval, and where would the use of one would be preferable to the other?
will execute a statement once when the time has run out
will execute the statement every interval miliseconds. Both can be cancelled - clearTimeout(TId) and clearInterval(IId). I would use setTimeout and reuse it in a function to simulate setInterval:
|
-- div -->
|