JSFiddle - React, Tailwind, and code Playground

HTML

<div id="test">counting…</div>

JavaScript

var start = null;
            var counter = 1,
                newTime, timeDiff, domer = 0, countingmiliseconds;


            function continueTimer() {
                newTime = new Date(),
                timeDiff = newTime.getTime() - start.getTime();
                domer = (timeDiff / counter);
                counter++;
                if (counter > 1000) {
                    document.getElementById('test').textContent = domer;
                    window.clearInterval(counting);                     
                }    
            }

            (function startTimer() {
                start = new Date();
                counting = window.setInterval(continueTimer, 16);
            })();