JSFiddle - React, Tailwind, and code Playground
HTML
Please check the console
CSS
body {
font-family: monospace;
}
JavaScript
// detect seconds in a second interval timer (works as expected)
setInterval(function() {
console.log('passed second from the secondInterval');
}, 1e3);
// detect seconds in a millisecond interval timer (I don't have explaination for the behavior).
(function() {
var i = 0;
setInterval(function() {
if (i === 0) {
i++;
return;
}
if (i % 1000 === 0) console.log('passed second from the secondInterval');
i++;
}, 1);
})();