Comparison between ‘Promise’ and ‘Async/Await’

Promise

function myAsyncFunction(){
  return myPromiseFunction().then(result => doSomething(result)).catch(handleError);
}

Async/Await

async function myAsyncFunction(){
  let result;
    
  try {
    result = await myPromiseFunction();
  } catch (err) {
    handleError(error);
  }

  return doSomething(result);
}