create typewriter javascript code example
Example: javascript typewriter effect
// *** JS Typewriter Effect ***
let i = 0;
let target = document.getElementById("target");
let text = target.innerHTML;
target.innerHTML = ' ';
let speed = 75; //speed duration of effect in millisec
typeWriter(); //to call function
function typeWriter() {
if (i < text.length) {
target.innerHTML += text.charAt(i);
i++;
setTimeout(typeWriter, speed);
}
}