Async Functions

Async functions allow you to write promise-based code as if it were synchronous, but without blocking the main thread.
If you use the 'async' keyword before a function definition, you can then use the 'await' within the function.
When you 'await' a promise, the function is paused in a non-blocking way and waits for the promise to complete.
If the promise succeeds then value is returned.
If the promise fails then execution is passed to the catch.

async function myFunction () { 
   try {
      const succeedvalue = await myPromise
   catch (rejectedValue) {

© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext