+ 1

How to use setinterval?

2nd Sep 2016, 8:11 PM
carlos amaro
carlos amaro - avatar
3 Answers
+ 3
setInterval(function() { // your code goes here }, 3000); // time in ms The setInterval() method calls a function or evaluates an expression at specified intervals. It will continue calling the function until the function clearInterval() is called, or the window is closed. btw, 1000 ms = 1 second.
2nd Sep 2016, 8:21 PM
Nenad__
Nenad__ - avatar
+ 2
In addition to what @Nenad__ said, if you're using setinterval on a pre-defined function, do not include the function parentheses. setfunction(func, 3000s)
6th Sep 2016, 7:19 AM
Sachin
Sachin - avatar
+ 1
Take a look at this example I did so you can have a better understanding: https://code.sololearn.com/WtWo50WAHrTt/#js
10th Aug 2017, 10:45 PM
Juan F R G
Juan F R G - avatar