+ 3
For what is setInterval, I do not understand where and how to use it
3 Answers
+ 3
x = setInterval(() => {console.log("hi")}, 500)
the code above will logs hi every 500ms
+ 3
Take a look at this example I did so you can have a better understanding:
https://code.sololearn.com/WtWo50WAHrTt/#js
+ 1
Generally when creating an animation on your webpage.
it work just like thread in Java.