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

View Markdown

Last edited on 2026-07-04

Called in Promise style: Not supported

Mini Program Mini Program: Supported

Sets a timer. The registered callback function is executed repeatedly at the specified interval (in milliseconds).

Parameters

function callback

Callback function

number delay

The time interval between the execution of callback functions, in ms.

any rest

Additional parameters such as param1, param2, ..., paramN, which will be passed to the callback function.

Return Value

number

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