JavaScript setInterval() Method
This method calls a function at specified intervals(in ms). This method will call continuously the function until clearInterval() is run, or the window is closed.
Syntax:
setInterval(fun, msec, p1, p2, ...)
Parameters:
- fun: It is required parameter. It holds the function to be executed.
- msec: It is required parameter. The time intervals (in milliseconds) after how long to execute the code. If the value is less than 10, then 10 is used.
- p1, p1, …: It is optional parameter. The parameters pass to the function as an arguments. (Not supported in IE9 and earlier).
JavaScript Call a function after a fixed time
In order to run a function multiple times after a fixed amount of time, we are using few functions.