title: How do I create JavaScript array (JSON format) dynamically?
body: <p>I am trying the create the following:</p>
  
  <pre><code>var employees = {
    "accounting": [ // accounting is an array in employees.
      {
        "firstName": "John", // First element
        "lastName": "Doe",
        "age": 23
      },
  
      {
        "firstName": "Mary", // Second Element
        "lastName": "Smith",
        "age": 32
      }
    ] // End "accounting" array.                                  
  
  } // End Employees
  </code></pre>
  
  <p>I started with</p>
  
  <pre><code> var employees = new Array();
  </code></pre>
  
  <p>How do I continue to create the array dynamically (might change <code>firstName</code> with variable)? I don't seem to get the nested array right.</p>