While it gets the job done, it's not very precise and isn't designed to be an exact timer. This has better solutions: https://stackoverflow.com/questions/196027/is-there-a-more-accurate-way-to-create-a-javascript-timer-than-settimeout/196138#196138 The demo on this site illustrates how this can be a problem: https://www.sitepoint.com/creating-accurate-timers-in-javascript/
While it gets the job done, it's not very precise and isn't designed to be an exact timer. This has better solutions: https://stackoverflow.com/questions/196027/is-there-a-more-accurate-way-to-create-a-javascript-timer-than-settimeout/196138#196138
The demo on this site illustrates how this can be a problem: https://www.sitepoint.com/creating-accurate-timers-in-javascript/