JSFiddle - React, Tailwind, and code Playground

JavaScript

var prom1 = new Promise(resolve => {
  setTimeout(resolve, 100);
});

prom1.then(() => console.log('then before promise resolved, runs first'));

setTimeout(function() {
	prom1.then(function() {
    console.log('then after promise resolved, immediate but async, runs third');
  });
  console.log('visually after the then above, but synchronous, runs second');
}, 200);

var prom2 = new Promise((resolve, reject) => {
  setTimeout(reject, 1100);
});

prom2.catch(() => console.log('catch before promise rejected, runs first'));

setTimeout(function() {
	prom2.catch(function() {
    console.log('catch after promise rejected, immediate but async, runs third');
  });
  console.log('visually after the catch above, but synchronous, runs second');
}, 1200);