title: How to map a javascript array to another javascript array
body: <p>I have a constructor in JavaScript which contains 2 properties <code>Key</code> and  <code>Values array</code>:</p>
  
  <pre><code>function Test(key, values) {
      this.Key = key;
      this.Values = values.map(values);
  }
  </code></pre>
  
  <p>Then I created an array of <code>Test objects</code>:</p>
  
  <pre><code> var testObjectArray = [];
   testObjectArray.push(new Test(1, ['a1','b1']), new Test(2, ['a1','b2']));
  </code></pre>
  
  <p>Now I want to map the <code>testObjectArray</code> to single <code>key-value</code> pair array which will be similar to :</p>
  
  <pre><code>[
      { "Key" : "1", "Value" : "a1" },
      { "Key" : "1", "Value" : "b1" },
      { "Key" : "2", "Value" : "a2" },
      { "Key" : "2", "Value" : "b2" },
  ]
  </code></pre>
  
  <p>How can I achieve this using array's <code>map</code> function?</p>