157
rated 0 times
[
159]
[
2]
/ answers: 1 / hits: 51184
/ 14 Years ago, thu, august 12, 2010, 12:00:00
I came across some unexpected behavior when passing a large millisecond value to setTimeout()
. For instance,
setTimeout(some_callback, Number.MAX_VALUE);
and
setTimeout(some_callback, Infinity);
both cause some_callback
to be run almost immediately, as if I'd passed 0
instead of a large number as the delay.
Why does this happen?
More From » settimeout