Topics


Pages


Content

Summary

Callback

foo('bar', function (bazz) {
  console.log(bazz.toUpperCase());
});

Promise

foo('bar')
  .then(function (bazz) {
    console.log(bazz.toUpperCase());
  });
  .catch(function(err) {
    console.log(err.toString())
  })

Async-await

try:
  const bazz = await foo('bar')
  console.log(bazz.toUpperCase());
catch(err) {
  console.log(err.toString())
}