Async/Await
Introduction to async and await in JavaScript.
We'll cover the following...
Background
We know two ways of writing asynchronous code. Although using promises prevents the “pyramid of doom,” it does not have neat syntax. To make things very clean, we can use Async/Await!
Introduction to async
async
token lets you declare a special type of function that always returns a promise. The async functions, unlike normal functions, is much neater when doing asynchronous tasks. Let’s declare an async function.
var func = async function(){
// Add tasks async or sync
}
The syntax is mostly the same as for a function ...