title: How can I destructure an array of arrays in JavaScript?
body: <p>I have an array of arrays. Each nested array contain objects, however it may contain array of objects. For example:</p>
  
  <pre><code>let arr=[[{a:1}],[{b:2}, [{c:3}, {d:4}]]]
  </code></pre>
  
  <p>I want to create an array which will contain only the objects destructuring all the arrays. I tried</p>
  
  <pre><code>arr.reduce((a,b) =&gt; [...a,...b], [])
  </code></pre>
  
  <p>but what am I getting is :</p>
  
  <pre><code>[{a:1}, {b:2}, [{c:3},{d:4}]]
  </code></pre>
  
  <p>which is not what I want.
  I want to get:  </p>
  
  <pre><code> [{a:1}, {b:2}, {c:3}, {d:4}]   
  </code></pre>