How to make time intervals in JavaScript
Can someone please help me and explain how I can make time intervals in a JavaScript project?
You do this:
setInterval(function() {
//your code
}, 1000);
This will run the function every time 1000 milliseconds (1 second) has past.
You can also first create a function (i.e. doThis() ) and write it like this instead:
setInterval(doThis, 1000);
Please sign in to leave a comment.