JSFiddle - React, Tailwind, and code Playground
by shapeshifta
JavaScript
function interval(func, wait, times) {
var interv = function (w, t) {
return function () {
if (typeof t === "undefined" || t-- > 0) {
setTimeout(interv, w);
try {
func.call(null);
} catch (e) {
t = 0;
throw e.toString();
}
}
};
}(wait, times);
setTimeout(interv, wait);
}
interval(function () {
var p = document.createElement("p");
var newContent = document.createTextNode("Hi there and greetings!");
p.appendChild(newContent);
document.body.appendChild(p);
}, 1000, 10);