Our booking platform includes a nested dataLayer variable. Users have the option to select one or multiple product types, and we are trying to extract a string that contains all the product types saved in an array. However, I am encountering an error when debugging this.
The variable location from which I need to gather the information is:
dataLayer.booking.products[i].travelType
try{
var productList = {};
for(i=0;i<dataLayer.booking.products.length;i++){
productList[dataLayer.booking.products[i].travelType];
}
return productList.join('|');
}
catch(err){}
I am not very experienced with JavaScript, so I apologize if this is a simple question for some.
https://i.sstatic.net/ZhcP2.png
M