I have the following code. I want to take the result of product variable and put them into an array outside of the lineItems.data.map so I can parse the arrary send a request with it's contents. I am a little stuck as to how to do this. I tried creating an empty array and pushing to it but it did not work. Any help would be great. thanks.
The array can be inside the first async function but I can't figure it out at this moment.
async function (err, lineItems) {
await lineItems.data.map(async (item) => {
console.log(item);
const product = await stripe.products.retrieve(item.price.product);
return product;
});
// I want an array here containing the product
}