title: Merge arrays into array of objects using map
body: <p>I’m trying to merge arrays with values;</p>
  
  <pre><code>const headers = ["DATE", "FGH", "DCP", "MRK"];
  const values = [["2019-06-12", 106, 125, 122 ], ["2019-06-14", 108, 128, 121]];
  </code></pre>
  
  <p>into array of objects in order to get final output:</p>
  
  <pre><code>[
    { DATE: "2019-06-12”, FGH: 106, DCP: 125, MRK: 122 },
    { DATE: "2019-06-14”, FGH: 108, DCP: 128, MRK: 121 }
  ]
  </code></pre>
  
  <p>using <code>.map</code> method;</p>
  
  <pre><code>this.mergedValues = this.values.map((val, i ) =&gt; 
    headers.map((headerVal, j) =&gt; ({
      [headerVal]: val[j]
    })))
  </code></pre>
  
  <p>but mapping of headers is wrong because it puts every item in object;</p>
  
  <pre><code>[ { DATE: "2019-06-12”}, {FGH: 106}, {DCP: 125}, {MRK: 122} ],
    ...
  ]
  </code></pre>