setInterval

View Markdown

Last edited on 2026-04-08

number setInterval(function callback, number delay, any rest)

Sets a timer to execute the registered callback function at the specified interval (in milliseconds).

Parameters

function callback

Callback function

number delay

Time interval between callback function executions, in ms.

any rest

Additional parameters such as param1, param2, ..., paramN, which are passed to the callback function as arguments.

Return Value

number

The ID of the timer. This value can be passed to clearInterval to cancel the timer.