Why do loops ignore async/await?

Hi, Baksheesh !!

I believe it’s correct to use await to wait for the processing of GetProfilePlan, but the issue is that the function GetProfilePlan itself is not an asynchronous function. To make it asynchronous, you need to add async. Additionally, you need to use await inside it to wait for getPlanInfo to complete.


async function GetProfilePlan (planID, index){
  console.log ("A. Item " + index)
  await getPlanInfo(planID, {suppressAuth: true})
    .then((result) => {
      console.log ("B. " + plan[index])
      })
}

2 Likes