title: Loop through nested dataLayer array to return pipe delimited strings
body: <p>We have a nested dataLayer variable on our booking platform. Users can make one or multiple variables are we want to pull out a string containing each of the product types contained within the array. I am hitting a error when debugging this however.</p>
  
  <p>The location of the variable I would like to collect is: </p>
  
  <p>dataLayer.booking.products[i].travelType</p>
  
  <pre><code>try{
    var productList = {};
    for(i=0;i&lt;dataLayer.booking.products.length;i++){
      productList[dataLayer.booking.products[i].travelType];
    }
    return productList.join('|');
  }
  catch(err){}
  </code></pre>
  
  <p>I am naive with JS so I apologies for a basic question.</p>
  
  <p><a href="https://i.stack.imgur.com/ZhcP2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZhcP2.png" alt="enter image description here"></a></p>
  
  <p>M</p>