title: Append an Array to an Unordered List
body: <p>What I'm trying to accomplish with this code is to output the array <code>alphabet</code> as a series of list items into an existing unordered list in the actual markup. I've got the array into list items, but I can't figure out how to tell it to append itself to an existing unordered list <code>&lt;ul id="itemList"&gt;&lt;/ul&gt;</code>. </p>
  
  <pre><code>var itemsExist = true;
  var indexNum = 0;
  var unorderedList = document.getElementById('itemList');
  var alphabet= new Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
  
  function write_letters(){
  
      for (i = 0; i &lt; alphabet.length; i++ ) {
          document.write('&lt;li&gt;'  + alphabet[indexNum++] + '&lt;/li&gt;');
      }
  
  }
  
  if (itemsExist){
      write_letters();
  } else {
      document.write("error!");
  }
  </code></pre>