Skip to content Skip to sidebar Skip to footer

Why I Am Getting Wrong Output In JavaScript?

Here I am trying to make a typing effect by pure Javascript Code. But it is giving me Wrong output. As I am new in JS, It is getting difficult to find out the problem. Can anyone h

Solution 1:

charAt[i] should be charAt(i):

let typingEffect1 = 'Front-End Designer';
var i = 0;

function typingFunction() {
  if (i < typingEffect1.length) {
    document.getElementById("typing-text").innerHTML += typingEffect1.charAt(i);
    i++;
    setTimeout(typingFunction, 100);
  }
}
typingFunction();
<div id="typing-text"></div>

Post a Comment for "Why I Am Getting Wrong Output In JavaScript?"