Async/Await—Simple Example in Four Lines

Understanding ES6' Async/Await

The simple example:

(async function() {
let a = await fetch('/')
console.log(await a.text())
})()

The simple example with a simple explanation:

The simple example again, this time with a in-depth explanation (zoom in if on mobile):

There’s much more about async/await but this might be a good start. Even if you don’t know anything about Promises yet, read the example, put the four lines into the browser’s JS console and play around: Leave one or both ‘awaits’ away, read the error messages and you should slowly get a feeling.