DEV Community

Discussion on: Nodejs, How do I wait until the previous post request is completed.

 
saroj990 profile image
saroj sasmal • Edited

There are two ways you can achieve this

  1. putting the last console log inside the callback of addEventlistener, it means your console log would be inside the addEventlinstener but after the if statement

  2. make the code that uses callback addEventListene a separate async method, simply use await on that method.