Skip to main content
Version: Next

setInterval

function setInterval(
callback,
delay?, ...
args?): number;

Set a repeated timer that calls a function, with a fixed time delay between each call.

Parameters

ParameterTypeDescription

callback

(...args) => void

A function to be executed every delay milliseconds.

delay?

number

(Optional) The milliseconds that the timer should delay in between execution of the function, by default is 1.

...args?

any[]

(Optional) Additional arguments which are passed through to the function.

Returns

number

The ID (integer) which identifies the timer created.

Throws

Throws TypeError if callback is not a function, or delay is neither a number or undefined.