开发者

The mystery arguments passed by setTimeout in Firefox [duplicate]

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜