Two questions:
-
How is the value returned from
setIntervalandsetTimeout(the ones used to clear the timers) calculated? -
Is it possible for both the functions to return the same value during runtime?
For example:var a = setInterval(fn1, 1000);
var b = setTimeout(fn2, 1000);
Is it possible for a and b to have the same value?
The first one is more of a for-my-knowledge question, but the second one is more important.
Returns a value which can be used to cancel the timer. So, it would seem unlikely that they return the same value (unless they are reusing values and one of the timers has already been cancelled)
Mozilla states it’s DOM level 0, but not part of the specification. (look at the bottom of the page)
I’ve got an even better reference:
Nabble says:
Read the original spec here, or from Sun (who was an early endorser of JavaScript).