title: Looping to create object Keys and Values in Javascript from 2D arrays
body: <p>I have two arrays, one which holds the keys and one which holds arrays, each array containing values. I would like to make an array of objects, where each object pairs the keys and values. To do this, I created an array, and I am now trying to create and fill objects before pushing them into the array. My code looks similar to this:</p>
  
  <pre><code>var keys = [key1, key2, key3];
  var values = [
                  [A-value1, A-value2, A-value3],
                  [B-value1, B-value2, B-value3],
                  [C-value1, C-value2, C-value3]
               ];
  
  var arrayOfObjecs = [];
  for(var i=0; i&lt;values.length; i++){
      var obj = {
      for(var j=0; j&lt;values[i].length; j++){
              keys[j] : values[i][j];
      }
      };
      arrayOfObjects.push(obj);
  }
  </code></pre>
  
  <p>In the end, I would like for my arrayOfObjects to look like this:</p>
  
  <pre><code>var arrayOfObjects = [
                          {
                           key1 : A-value1,
                           key2 : A-value2,
                           key3 : A-value3
                          },
                          {
                           key1 : B-value1,
                           key2 : B-value2,
                           key3 : B-value3
                          },
                          {
                           key1 : C-value1,
                           key2 : C-value2,
                           key3 : C-value3
                          }
                       ];
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/1290131/javascript-how-to-create-an-array-of-object-literals-in-a-loop">This question</a> is similar to what I want to do, yet it won't allow me to loop a second time within the object.</p>