According to W3Schools timeout is required parameter. But it is possible to call it without timeout parameter.
function eventHandler(e) { var t = setTimeout(function () { clearTimeout(t); alert('Called'); }); }
Specifies the function that will be executed. Not required. Specifies the time the function will be executed. 0 milliseconds by default.
The syntax is: setTimeout(function, milliseconds, parameter1, .... paramenterN); When you pass additional parameters to the setTimeout() method, these parameters ( parameter1 , parameter2 , etc.) will be passed to the specified function.
Invoking setTimeout with a callback, and zero as the second argument will schedule the callback to be run asynchronously, after the shortest possible delay - which will be around 10ms when the tab has focus and the JavaScript thread of execution is not busy.
window. setTimeout() . It's all the same method of the same object.
The HTML5 Timer
spec says:
5) Let timeout be the second method argument, or zero if the argument was omitted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With