对于FireFox 3.x和4.x 来说,SetTimeout函数第二个参数的值是2^31 = 2147483648ms(毫秒)。
当计时器的数值高于这个值是将会出现大家可以理解的情况——立即超时。
对于IE来说,至少对于IE8来说,setTimeout的值比1<<31大。但是作为前端工程师……你们懂的。
其他浏览器未涉及。
摘录Google到的一段话:
Thanks to Mozilla's open source you can look up stuff like this, the only problem is finding it.
DOM_MAX_TIMEOUT_VALUE is defined here (http://lxr.mozilla.org/mozilla/source/dom/src/base/nsGlobalWindow.cpp#224). PR_BIT(x) is defined as 1 << (x) and PRIntervalTime is a 32 bit integer, so the result is 1 << 31 or 2147483648.
Of course there's no guarantee that other browsers have the same limit.