title: Return array of each element of a nested array
body: <p>I have two objects Order and ProductOrder.</p>
  
  <pre><code>Order Object:
  {
  id:number;
  productOrders: ProductOrder[];
  }
  
  ProductOrder object:
  {
  id: number;
  productName: string;
  }
  </code></pre>
  
  <p>now i have an array of Order object stored in orders variable:</p>
  
  <pre><code>const orders: Order[];
  </code></pre>
  
  <p>Now I want to loop through each order and and further loop through each ProductOrder and return an array of all the ProductOrders. </p>
  
  <p>Using forEach loop we can do this in the following way:</p>
  
  <pre><code>const productOrders: ProductOrder[] = [];
      this.orders.forEach(o =&gt; {
        o.productOrders.forEach(po =&gt; {
          productOrders.push(po);
        });
      });
  </code></pre>
  
  <p>Now I want to know instead of using two forEach loop and then adding each productOrder in a pre declared array, is there a simpler way to achieve this using map function or something else?</p>