JSFiddle - React, Tailwind, and code Playground
JavaScript
doShit();
function thing(x){
alert(Math.floor((new Date() - x)/1000));
//setTimeout(function() {thing(x);}, 500);
}
function doShit(){
var x = new Date();
setTimeout(function() {thing(x);}, 1000);
}