JavaScript setInterval
Call the function or execute a code snippet repeatedly, with a fixed time delay between each call to that function.
Example1- Program to Display “Hello World! Welcome to WDH” every second=1000 millisecond:
In this code Continuously repeated within 1 second = 1000 milliseconds.
Uses of JavaScript setInterval()
-
Periodic execution
-
Counters
Example2 Program to The setInterval() and clear methods
Output
After five second