Facts on Javascript Async/Await & Promises

Tao Liu
1 min readSep 21, 2019

Above is a great link with info. Some things I want to summarize:

  1. The async keyword in front of a function RETURNS another function. That returned function is an asyncFunction Object, which is simply another type of function. It is as if you are passing that function as an argument to ‘async.’ That returned async function, when later called, will then return a Promise.
  2. In JavaScript, functions are first-class objects, because they can have properties and methods just like any other object. What distinguishes them from other objects is that functions can be called. In brief, they are Function objects.
  3. Await is written in front of Promises to wait for them to resolve before continuing executing code.
  4. When await is written in front of an async function call (remember, they return Promises), it means that we will wait for the Promise to resolve.
  5. The await inside an async function is what will keep the returned Promise from resolving, until the awaited Promise is first resolved. So it is a Promise inside a Promise.

--

--