title: Attempting to display array in a table (Javascript + html)
body: <p>Currently, I have a text box and date-time local input that stores something into an array every time I click on a submit button. The arrays work, however, I do not seem to be able to put them into a table using a for loop and displaying them. Here is the JavaScript that is relevant: </p>
  
  <pre><code>var eventName = new Array();
  var theDate = new Array();
  var index = 0;
  var index2 = 0;
  
  function submitNewEvent() {
  
  eventName[index] = document.getElementById("eventName").value;
  index++;
  
  theDate[index2] = document.getElementById("date").value;
  index2++;
  
  
  
      var newTable = "&lt;table&gt;";
      for (var i=0; i &lt; eventName.length; i++){
      newTable += "" + eventName[i] + "&lt;br&gt;"
      }
  }
  </code></pre>
  
  <p>Here is how I am attempting to display the table in HTML: </p>
  
  <pre><code>    &lt;script&gt; 
          document.write ('&lt;p&gt;colour1: ' + newTable + '&lt;/p&gt;');
      &lt;/script&gt;
  </code></pre>
  
  <p>Any help and suggestions will be greatly appreciated! </p>