title: How do I declare a new object within the same for loop without overwriting my previous iterations?
body: <p>So my problem with this excercise is that after I have converted the first nested array into an object, the iteration will go into the next nested array and overwrite the first nested array I had just converted. </p>
  
  <p>So one of my questions is how do I tell my code to stop iterating over what I just converted to an object and create a new object with the next nested array I need to convert?</p>
  
  <p>Adding to my previous question, according to the exercise, I need to place my newly made objects and store them within an array. I planned on creating the objects first then pushing them into a placeholder array variable at the end. Is there a more efficient way to to this in the loop?</p>
  
  <p>Any help would be appreciated, still kinda new here so dont be too mean haha.</p>
  
  <p>Heres what Ive done so far + instructions!</p>
  
  <p>*Write a function called “transformEmployeeData” that transforms some employee data from one format to another.</p>
  
  <p>The argument will look like this:</p>
  
  <pre><code>[
      [
          ['firstName', 'Joe'], ['lastName', 'Blow'], ['age', 42], ['role', 'clerk']
      ],
      [
          ['firstName', 'Mary'], ['lastName', 'Jenkins'], ['age', 36], ['role', 'manager']
      ]
  ]
  Given that input, the return value should look like this:
  
  [
      {firstName: 'Joe', lastName: 'Blow', age: 42, role: 'clerk'},
      {firstName: 'Mary', lastName: 'Jenkins', age: 36, role: 'manager'}
  ]
  </code></pre>
  
  <p>Note that the input may have a different number of rows or different keys than the given sample.</p>
  
  <p>For example, let’s say the HR department adds a “tshirtSize” field to each employee record.
  Your code should flexibly accommodate that. *</p>
  
  <pre><code>    function transformEmployeeData(employeeData) {
    debugger;
    var obj = {};
    for (var i = 0; i &lt; employeeData.length; i++) {
      for (var y = 0; y &lt; employeeData[i].length; y++) {
        obj[employeeData[i][y][0]] = employeeData[i][y][1]
      }
    }
    return obj
  }
  </code></pre>