Intro Before learning about async/await you should know what and how promises work in JavaScript. You can read about promises here. What is async keyword? async/await were introduced in 2017, Before that time managing asynchronous operations in javaS...
shubhsharma19.hashnode.dev4 min read
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)
Sundar Gupta
Developer, Explorer, Designer, BCA Graduate
Such a good one!