title: Javascript - Writing out one letter at a time?
body: <p>Here's what I've done so far:</p>
  
  <pre><code>&lt;div id='test'&gt;
  
  &lt;/div&gt;
  
  &lt;script src='http://code.jquery.com/jquery-latest.js'&gt;&lt;/script&gt;
  &lt;script&gt;
      var timePerLetter = 2000;
      var newLineCharacter = '|';
  
      function printOut(text) {
          for(var i = 0; i &lt; text.length; i++) {
              var CHAR = text[i];
  
              switch(CHAR) {
                  case newLineCharacter:
                      setTimeout( $('#test').append('&lt;br&gt;'), timePerLetter);
                  default:
                      setTimeout( $('#test').append(CHAR), timePerLetter);
              }
          }
      }
  
      printOut("HELLO ASDA| SD");
  &lt;/script&gt;
  </code></pre>
  
  <p>It prints out as it should, somewhat.
  It prints:</p>
  
  <pre><code>HELLO ASDA
  | SD
  </code></pre>
  
  <p>But, it does <strong>not</strong> wait two seconds per letter, how can I fix this?</p>