Skip to content

setTimeout ​

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

Sets a timer that executes the registered callback function after the timer expires.

Parameters

  • function callback: Callback function

  • number delay: Delay time, after which the function is called, 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 clearTimeout to cancel the timer