title: Iterate through an array in a map in javascript
body: <p>I'm new to javascript and I'm having trouble wrapping my head around how to use an array of keys to extract a map, then extract values from an array in the map, without completely recreating the map.  My two data structures looks like.</p>
  
  <pre><code>var keys = ["key1","key2","key3"]
  
  var data = {
  "key1": {
      "target": "hostname",
      "datapoints": [
          [12, 1.42472334E9],
          [13, 1.424723355E9],
          [14, 1.42472337E9]]},
  "key2": {
      "target": "hostname",
      "datapoints": [
          [15, 1.42472334E9],
          [16, 1.424723355E9],
          [17, 1.42472337E9]]}}
  </code></pre>
  
  <p>I'm trying to extract the data points to place them in into two arrays for graphing based on the key.  Trying to iterate like:</p>
  
  <pre><code>for (var k in key)
      for (var v in data[key][datapoints])
  </code></pre>
  
  <p>Is obviously not the correct approach.  Is there a better way to get the data without tearing apart the map?</p>