title: Using Array.map(), to extract values from array of key:value objects
body: <p>I have been able to use the following code to extract values for a list of specific keys from an array of objects.</p>
  <pre><code>let keys = ['name', 'age'];
  let employees = [
    {name: 'Matt', employeeID: 123, performance: 'good', age: 21},
    {name: 'Brian', employeeID: 321, performance: 'average', age: 32},
    {name: 'David', employeeID: 456, performance: 'best', age: 35},
    {name: 'Kevin', employeeID: 654, performance: 'poor', age: 38},
    {name: 'Barrack', employeeID: 789, performance: 'super', age: 47},
  
  ];
  
  let extracted = employees.map(object =&gt; keys.map(element =&gt; object[element]));
  console.log(extracted); //result is [[Matt, 21.0], [Brian, 32.0], [David, 35.0], [Kevin, 38.0], [Barrack, 47.0]]
  </code></pre>
  <p>I have a hard time understanding conceptually how using two <code>Array.map()</code> methods nested within each other works like this. Can somebody walk me through how this actually works? For instance if I want to use only one <code>Array.map()</code> method to recreate the above, I end up with an array of truncated objects that still includes <code>key:value</code> pairs.</p>
  <pre><code>let truncated = employees.map(({name, age, ...rest}) =&gt; ({name, age}));
  console.log(truncated); //result is [{age=21.0, name=Matt}, {age=32.0, name=Brian}, {age=35.0, name=David}, {name=Kevin, age=38.0}, {age=47.0, name=Barrack}]
  </code></pre>