In javascript sometime you have to perform task repeatedly, in that case setInterval() method can be handy to use.
Syntax:-
setInterval(function,time_in_milliseconds,param);
setInterval accept time in millisecond,
let try an example:-
setInterval(function(){ myFunction(); }, 3000);
function myFunction(){
alert("Alert in every 3 second!");
}
So here with the help of setInterval() we are calling myFunction() function in every 3 second.
0 Comment(s)