title: How to merge multiple arrays in foreach loop in Javascript
body: <p>How to merge multiple arrays in foreach loop. I'm trying to merge all 3 <code>imageData</code> arrays in one single array. Please tell if I missed anything from following method.</p>
  <pre><code>  const imageArray = [
        {
          imageData: [
            'https://via.placeholder.com/50',
            'https://via.placeholder.com/60'
          ],
        },
        {
          imageData: [
            'https://via.placeholder.com/100'
          ],
        },
        {
          imageData: [
            'https://via.placeholder.com/150'
          ],
       }
    ];
  
    processImage() {
      imageArray.forEach((element) =&gt; {
        const imageCollection = [...element.imageData];
        console.log(imageCollection);
        // Expected result 
        //['https://via.placeholder.com/50', 'https://via.placeholder.com/60', 'https://via.placeholder.com/100', https://via.placeholder.com/150]
      });
    }
  </code></pre>