JavaScript Window setInterval()
JavaScript Window setInterval()
The setInterval() method is used for calling a function at specified intervals in milliseconds. It continues calling the method until clearInterval() is called or otherwise, the window is closed. For your information, 1000 milliseconds = 1 second.
Syntax:-
Its syntax is:- setInterval(function, milliseconds, param1, ...)
Return:-
Its return is:- id of timer in number which can be used with clearInterval(id) to cancel the timer
Further Explanation:-
Parameter | Description |
function | Required. The function to execute |
milliseconds | Required. The execution interval. |
param1, ... | Optional. Additional parameters to pass to the function. |