title: Text typing with animation using setTimeout() doesn't working
body: <p>I tried to write a program that is typing text in the field with animation. But it does not work. WHY???</p>
  
  <pre><code>var str = "SuperUser";
  var i = 0;
  var inp = document.getElementsByTagName("input")[0];
  
  function enter(str, elem, i){
     elem.value += str[i];
     i++;
     setTimeout(enter(str, inp, i), getRandomInt(500, 2000))
  }
  setTimeout(enter(str, inp, i), getRandomInt(500, 2000))
  
  function getRandomInt(min, max) {
      return Math.floor(Math.random() * (max - min)) + min;
  }
  </code></pre>
  
  <p>Error screenshot:</p>
  
  <p><a href="https://i.stack.imgur.com/jsI1f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jsI1f.png" alt="JS console error on chrome browser"></a></p>