Estoy tratando de obtener datos dentro del bucle for y está usando async await y quiero completar esos datos en la matriz de objetos existente, pero no funciona.
Aquí está mi código:
for (let i = 0; i < listing.length; i++) { var listingDetails = null; (async () => { const list = await sdk.listing.query({ listing_id: listing[i].id }) listingDetails = list.data && list.data.data // I am expecting this to replace the default value of listingDetails variable })() listing[i].details = listingDetails console.log(listingDetails) // But when it comes here, the listingDetails is still null } El último console.log() , esperaba que los datos estuvieran allí, pero no estaban allí. Debido a esto, no puedo volver a completar los detalles.