setInterval(function,interval) function. With the
setInterval() method, we can specify a function that, for instance, would be called every 100 milliseconds. The problem with this function is that it doesn't take into account what is happening in the browser. If you were browsing another tab, this function would still be fired every couple of milliseconds. Besides that, the
setInterval() method isn't synchronized with the redrawing of the screen. This could lead to higher CPU usage ...