Promises - Finally

by wimpyprogrammer

JavaScript

function asyncFunction() {
  return Promise.reject(new Error('Something went wrong!'));
}

asyncFunction()
  .then(function() {
    console.log('then', arguments);
  })
  .catch(function() {
    console.log('catch', arguments);
  })
  .then(function() {
    console.log('finally', arguments);
  });