Skip to content

setInterval ​

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

Sets a timer that executes the registered callback function at the specified interval (in milliseconds).

Parameters

  • function callback: Callback function

  • number delay: Time interval between executions of the callback function, in ms

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

Return Value

  • number: The timer ID. This value can be passed to clearInterval to cancel the timer