Functions
setInterval
setInterval(handler
, timeout
, ...args
): number
The global setInterval()
method repeatedly calls a function or executes a code snippet, with a fixed time delay between each call.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
handler | TimerHandler | undefined | The function or string to be executed every time the interval elapses. |
timeout | number | 0 | The time, in milliseconds, the timer should delay in between executions of the specified function or code. 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 clearInterval()
method to cancel the timer.