JSFiddle - React, Tailwind, and code Playground
by mblase75
HTML
<div id="console_div"></div>
JavaScript
var text = new Array();
text[0] = "welcome ".split('');
text[1] = "how are you?".split('');
var delay = 400;
function addOneChar(i, j) {
$('#console_div').append('<br>' + text[i][j]);
if (j+1<text[i].length) {
setTimeout(function () {
addOneChar(i, j+1);
}, delay);
} else if (i+1<text.length) {
setTimeout(function () {
addOneChar(i+1, 0);
}, delay);
} // else quit
}
setTimeout(function () {
addOneChar(0,0);
});