Functions
setTimeout
setTimeout(handler, timeout, ...args): number
The global setTimeout() method sets a timer which executes a function or specified piece of code once the timer expires.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
handler | TimerHandler | undefined | The function or string to be executed after the timer expires. |
timeout | number | 0 | The time, in milliseconds, the timer should wait before the specified function or code is executed. If this parameter is omitted, a value of 0 is used. |
...args | any[] | undefined | Additional arguments to be passed to the function specified by the handler parameter. |
Returns
number
The numeric ID of the timer, which can be used later with the clearTimeout() method to cancel the timer.