title: Get union of keys of all objects in js array using reduce
body: <p>Assume , we have : </p>
  
  <pre><code>var all=[
      {firstname:'Ahmed', age:12},
      {firstname:'Saleh', children:5 }
      {fullname: 'Xod BOD', children: 1}
  ];
  </code></pre>
  
  <p>The expected result is <code>['firstname','age', 'children', 'fullname']</code>: the union of keys of all objects of that array:</p>
  
  <pre><code>all.map((e) =&gt; Object.keys(e) ).reduce((a,b)=&gt;[...a,...b],[]); 
  </code></pre>
  
  <p>This is work fine , However, i am seeking a solution more performance using directly <code>reduce</code> method without <code>map</code> , I did the following and it is failed.</p>
  
  <pre><code>all.reduce((a,b) =&gt;Object.assign([...Object.keys(a),...Object.keys(b)]),[])
  </code></pre>