JSFiddle - React, Tailwind, and code Playground
HTML
<div id="text"></div>
JavaScript
$(document).ready(function () {
var text = "example text";
var i = 0;
var consoleTyper = setInterval(function () {
if (i != text.length) {
i += 1;
document.getElementById("text").innerHTML = text.substr(0, i);
}
else
{
clearInterval(consoleTyper);
}
console.log(i);
}, 50);
});