I've searched through everything I can on SO and elsewhere but can't find an answer, this is mostly due to my limited JS knowledge.
Could anyone tell me how to extract values from an array that is similar to the following (enhanced ecommerce array in dataLayer);
var products = [
{ brand: "brandx", category: "categorya", name: "name123" },
{ brand: "brandy", category: "categoryb", name: "name345" }
];
I would just like to extract the name in this case and end up with another array with just the values in, e.g. [name123,name345]. I'd like to push this into the dataLayer again, but I think I can do that part myself.
I did have some success but that was only in selecting the first name value.
Thank you in advance for any help anyone can offer
Matt