async...await
ES8 provides a new syntax for handling asynchronous action.
The command await means “just wait for the promise to resolve”.
Await is only valid in async function.
It will return a promise asynchronously after however many calls of await. Meaning, one can set async once and within that function as many awaits as one wants, thus avoiding to write then for every time.
One makes the function asynchronous by adding the modifier async before declaring the function, like:
Ok, this was pretty hard to wrap my head around, but I get the general idea of this syntax: it doesn’t add an additional function, it just makes the code more readable, economical and scalable, meaning the async...await syntax is syntactic sugar.
















