title: Insert text within two brackets - Javascript
body: <p>I want to have a typewriter effect so that I start with {} and each letter of the word is typed in every 120 ms. I've almost accomplished this with the following code :</p>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>&lt;script type='text/javascript'&gt;
  var index = 0;
  var text = 'hello'
  
  // Here you can put in the text you want to make it type.
  function type()
  {
      document.getElementById('screen').innerHTML += text.charAt(index);
      index += 1;
      var t = setTimeout('type()',120);
  }
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;body onload="type()"&gt;
  ...
  &lt;div id='screen'&gt;{&lt;/div&gt;
  ...
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My problem is that while the word is typing, there's no closing brace. So after the first 120 ms it looks like this: {h</p>
  
  <p>But I want it to look like this {h}</p>
  
  <p>How can I fix this?</p>