title: How to Aggregate Multiple Arrays to a Single Array
body: <p>I have to call an endpoint multiple times and get the responses aggregated to a single array. Below is the response from the endpoint;</p>
  <pre><code>{
     items: [
        {key1: value},
        {key2: value}
     ]
  }
  </code></pre>
  <p>Below is the code to call the endpoint multiple times;</p>
  <pre><code>const chunkedArray = getChunkedArray(largeArray);
  const result = await Promise.all(
     chunkedArray.map(async (items) =&gt; {
        const response = await ....get(`http:/url/${items}`);
        return response.items;
     });
  );
  
  </code></pre>
  <p>For the result I'm getting below;</p>
  <pre><code>[
     [
        {key1: value},
        {key2: value}
     ],
     [
        {key3: value},
        {key4: value}
     ]
  ]
  </code></pre>
  <p>What I want is an aggregated array like below;</p>
  <pre><code>[
     {key1: value},
     {key2: value},
     {key3: value},
     {key4: value}
  ]
  </code></pre>
  <p>What is the optimum way of doing that?</p>