A function always returns a promise.

Function returns a promise, and wraps non-promises in it.


Async function f() {
  return 1;


Makes JavaScript wait until that promise settles and returns its result.

The await keyword before a promise makes JavaScript wait until that promise settles, and then.


// works only inside async functions
let value = await promise;
If it's an error, the exception is generated, same as if throw error were called at that very place.
Otherwise, it returns the result, so we can assign it to a value.

Related concepts

Async — Structure map

Clickable & Draggable!

Async — Related pages: