最佳答案
当向 setTimeout()
传递一个很大的毫秒值时,我遇到了一些意想不到的行为,
setTimeout(some_callback, Number.MAX_VALUE);
还有
setTimeout(some_callback, Infinity);
两者都会导致 some_callback
几乎立即运行,就好像我传递的是 0
而不是一个很大的数字作为延迟。
为什么会这样?