title: Fetch multiple properties from an array of objects and form a new one : Javascript
body: <p>Been trying to do the following thing:</p>
  
  <p>I have an array of objects ,</p>
  
  <pre><code>
  var arr = [
    { key: "aabFaa", text: "aabFaa" ,field: "firstName",checked: true},
    { key: "aAaaaa", text: "aAaaaa", field: "firstName", checked: true },
  ];
  
  </code></pre>
  
  <p>Would want to fetch the "text" and "field" out of it and form a new array of objects something like this:</p>
  
  <pre><code>result = [ { "field" : "firstName" , value : "aabFaa" , type :"add"}, 
             { "field" : "firstName" , value : "aAaaaa" , type: "add"}
           ]  
  
  </code></pre>
  
  <p>Here type is hard coded one, where as rest are fetched from the "arr"</p>
  
  <p>Whats the easier way to do this?</p>
  
  <p>Have tried this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var arr = [
    { key: "aabFaa", text: "aabFaa" ,field: "firstName",checked: true},
    { key: "aAaaaa", text: "aAaaaa", field: "firstName", checked: true },
  ];
  
  let result = arr.map(a =&gt; a.text); 
  console.log(result)</code></pre>
  </div>
  </div>
  </p>
  
  <p>But this has to be written in multiple lines to get desired properties.Is there an easier approach?</p>