Async Functions are introduced officially in ECMAScript 7 Spec, as the ultimate way to solve async code writting problems (especially the famous callback hell).
We can easily get the resolved value of a Promise with
Promise or any value to wait for.
Returns the fulfilled value of the promise, or the value itself if it’s not a
See also: await | MDN
The code above will print objects in the original loop order, each
timeout function was executed in serial sequence, resulting the total ellapsed time to be the sum of all loops:
no matter how much time each one take