What is the difference between setTimeout(fn, 0) and setTimeout(fn, 1)?

后端 未结 6 2013
执念已碎
执念已碎 2020-11-28 07:05

The jQuery source features uses of setTimeout with both 0 and 1 as second argument. I\'m under the impression that they both mean &quo

6条回答
  •  眼角桃花
    2020-11-28 07:47

    It's simply an example of bad code practice in the jQuery source.

    That's all. There's no reason to favor 0 over 1 or vice versa.

    Raise a jQuery bug, have it fixed / normalized to use one or the other.

提交回复
热议问题