Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to put two function in a one setInterval function?

I know about setInterval syntax:

setInterval(function,milliseconds)

I want two functions to be called at the same time instead of one for every 8 seconds. Is there any way to do it by setInterval function like this?

setInterval(function1, function2, 8000)

like image 947
user3304614 Avatar asked Feb 18 '14 09:02

user3304614


1 Answers

Yes, you can do that, write a wrapper function for that both functions.

Try

setInterval(function(){ function1(); function2(); },8000)
like image 63
Rajaprabhu Aravindasamy Avatar answered Sep 21 '22 13:09

Rajaprabhu Aravindasamy