There are many complex concepts in programming and even more ways to make them seem complicated.

Luckily async / await is easy to understand and I will explain it in just 1 sentence… Wait for it… wait for it… Go!

async function will always return a promise and await operator gives us the opportunity to wait for a promise within the function.

Everybody knows that jQuery ajax() method returns a promise. Thus I used it in this example.

It should be simple now. When you enter the metro and buy that ticket, railroad company gives you the promise that train will arrive at specific time. The only thing that you need to do is to await for it…

Can You Use it?

Node.js introduced support for async / await from version 7.6.0

Browser support is horrible as usual (for new features). IE completely ignores it and Edge implemented it in version 15.

Babel is luckily there to help us Async to generator transform

Have in mind that await operator is tightly coupled with async function and that it can’t be used outside of it!