@tebogoselahle
Software Engineer @ Takealot
I am a software engineer for Takealot.com living in Cape Town.
Nothing here yet.
Great article! Another great use of async/await is when your code needs to do 2 async operations that are not dependent on each other. For example, if your method needs to retrieve users and companies, you can call the async getUsers method and store the resulting Promise in a variable. You do the same for the getCompanies method. Now you have 2 promises that are executing in parallel and you can the await them afterwards. This gives the benefit of not having to run the two independent calls synchronously and cuts the method time by half (assuming both calls take the same time)