JSFiddle - React, Tailwind, and code Playground
JavaScript
var text = "Use timeouts with callbacks. You can do this natively with javascript using setTimeout, or with jQuery using delay. In order to facilitate the repetition, you could use a recursive loop with a counter for completion in addition to current text offset.";
var textArr = text.split(" ");
var d = $("#d")[0];
(function write(i,n){
if( n == textArr.length ){
d.innerHTML = text;
return;
}
if( i == textArr[n].length ){
d.innerHTML = "";
setTimeout(function(){write(0,++n)},10);
}else{
d.innerHTML += textArr[n][i++];
setTimeout(function(){write(i,n)},10);
}
})(0,0)