title: adding multiple values to single array item in javascript
body: <p>I am having trouble with output of an array, I think.</p>
  
  <p>What I would like the output to look like is:</p>
  
  <pre><code>1. FirstName LastName DOB
  </code></pre>
  
  <p>but what I end up with is:</p>
  
  <pre><code>1. FirstName
  2. LastName
  3. DOB
  </code></pre>
  
  <p>Here is what I have so far but I am not seeing what I am doing wrong.</p>
  
  <pre><code>// global variable:
  var tasks = []; 
  
  // Function called when the form is submitted.
  // Function adds a task to the global array.
  function addTask() {
      'use strict';
  
      // Get the task:
      var firstName = document.getElementById('firstName');
      var lastName = document.getElementById('lastName');
      var dob = document.getElementById('dob');
  
      // numerical value of dob
      var dateofBirth = new Date(dob.value);
  
      // Reference to where the output goes:
      var output = document.getElementById('output');
  
      // For the output:
      var message = '';
  
      if (firstName.value &amp;&amp; lastName.value &amp;&amp; dob.value) {
  
          // Add the item to the array:
          tasks.push(firstName.value, lastName.value, dateofBirth.toString());
  
  
          // Update the page:
          message = '&lt;h2&gt;Persons Entered&lt;/h2&gt;&lt;ol&gt;';
          for (var i = 0, count = tasks.length; i &lt; count; i++) {
              message += '&lt;li&gt;' + tasks[i] + '&lt;/li&gt;';
          }
          message += '&lt;/ol&gt;';
          output.innerHTML = message;
  
      } // End of IF.
  
      // Return false to prevent submission:
      return false;
  
  } // End of addTask() function.
  
  // Initial setup:
  function init() {
      'use strict';
      document.getElementById('theForm').onsubmit = addTask;
  } // End of init() function.
  window.onload = init;
  </code></pre>
  
  <p>Thanks, I hope this helps you to help me.</p>