开发者

The mystery arguments passed by setTimeout in Firefox [duplicate]

开发者 https://www.devze.com 2023-04-07 13:30 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Firefox setTimeout(func, ms) sending default parameters to callback
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Firefox setTimeout(func, ms) sending default parameters to callback

I have been wondering this for a long time. When I type in the following line in FF, then I get:

var timer = setTimeout(function () {console.log(arguments)}, 500);

arguments outputs an array with a random number开发者_JAVA技巧 in it, and this number is different from the value of the timer. When I try on Chrome, the arguments is an empty array.

Anyone has noticed this?


From https://developer.mozilla.org/en/window.setTimeout:

Gecko passes an extra parameter to the callback routine, indicating the "lateness" of the timeout in milliseconds.

0

精彩评论

暂无评论...
验证码 换一张
取 消