setInterval(function,interval) function. With
setInterval, we could 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,
setInterval isn't synchronized with the redrawing of the screen. This can lead to higher CPU usage and bad performance.