JSFiddle - React, Tailwind, and code Playground
JavaScript
// Fake setInterval, but a good polyfill
function pseudoSetInterval(fn, time /* [, param1, param2, ...]*/) {
var args = Array.prototype.slice.call(arguments,2);
setTimeout(function interval() {
setTimeout(interval, time);
fn.apply(window,args);
}, time);
}
var start = new Date();
// Timing function to console.log each time it is executed
function timingFn() {
var current = new Date();
console.log('pseudoSetInterval executing: ' + (current - start));
}
// Start the setInterval
pseudoSetInterval(timingFn, 1000);